我有以下代码:
public Task<Service> GetSomething()
{
using (var myContext = new DbContext())
{
var returnObj = (from rp in myContext.Services1
join op in myContext.Services2 on rp .Id equals op.ServiceId into g
join ep in myContext.Services3 on rp .Id equals ep.ServiceId
from n in g.DefaultIfEmpty()
where rp.Name == code
select rp).FirstOrDefaultAsync();
return returnObj;
}
}
Run Code Online (Sandbox Code Playgroud)
现在这正在工作,但我遇到了错误:
The operation cannot be completed because the DbContext has been disposed.
Run Code Online (Sandbox Code Playgroud)
读完后,看起来像是FirstOrDefaultAsync一个延迟执行,我需要将其转换为list第一个执行才能使其具体化。
我该如何转换这个查询的结果,因为我尝试过,但后面.ToListAsync()没有任何结果了。FirstOrDefault
我的页面里面有这个div;
<div class="workspace" id="workspace">
<div data-ng-repeat="node in controller.Nodes" on-last-repeat=on-last-repeat>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
在我的打字稿代码上,我有这个来检查是否有必要的字段未设置.
if ($('#workspace').find('.ng-invalid').length != 0)
Run Code Online (Sandbox Code Playgroud)
这不起作用.长度总是0.我也尝试了以下但没有运气:
if ($('#workspace').find('.has-error.form-control').length != 0)
if ($('#workspace').find('.invalid').length != 0)
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?