我在查询中使用了一个简单的表达式:
private Expression<Func<Account, NewAccount>> DefaultColumns {
get {
return o => new NewAccount() {
Name = o.Name,
Id = o.Id
};
}
}
我可以在我的查询中使用它:
await this.context.Accounts.Where(o => o.Id == id).Select(DefaultColumns).FirstOrDefaultAsync();
没有问题。但是,我的一些查询使用查询语法:
var q = from a in context.Accounts
join c in context.Contracts
on a.Id equals c.AccountId
where c.Id == id
select a;
如何使用我的显式列定义和查询方法?我不想在多个位置定义这些列选择。
答案 0 :(得分:2)
为什么不喜欢这个?
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
<div class="video-container"> // could also be <body class="video-container">
<video autoplay loop poster="wp-content/themes/murastekylaselts/video.jpg" id="bgvid" muted="muted ">
<source src="wp-content/themes/murastekylaselts/video/video.webm" type="video/webm">
<source src="wp-content/themes/murastekylaselts/video/video.mp4" type="video/mp4">
</video>
</div>