我想将新的异步等待功能应用于导入到我的实体模型中的存储过程/函数导入,但尚未与EF6 alpha一起使用。EF6 alpha异步等待实体存储过程/函数导入?
在EF6 alpha2(或20211的夜间版本)中,是否可以调用返回复杂类型集合的Entity Function Import(调用SQL存储过程)上的任何新Async方法?例如
private async Task<IList<Company>> getInfo (string id)
{
using (CustomEntity context = new CustomEntity())
{
var query = await context.customStoredProcedure(id).ToListAsync();
// ".ToListAsync()" method not available on above line
// OR ALTERNATIVELY
var query = await (from c in context.customStoredProcedure(id)
select new Company
{
Ident = c.id,
Name = c.name,
Country = c.country,
Sector = c.sector,
etc. etc....
}).ToListAsync();
// ".ToListAsync()" method or any "...Async" methods also not available this way
return query;
}
}
“ToListAsync”,或任何新的异步改性方法似乎不提供给存储过程/函数导入上述实体;只有标准的“ToList”或“AsNumerable”等方法可用。
我跟着这个(http://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20EF6),以确保代码是引用新的EF6 DLL而不是EF5,以及更新各种使用语句。除了上面以外,所有内容都可以正确构建。 (.NET Framework 4.5)
我唯一可以看到异步方法的是,如果不是只从数据库导入存储过程,我还导入一个表 - 然后当通过上面的实体上下文引用该表时context.SomeTable),一些异步方法出现在intellisense中。
我真的很想在将数据作为JSON返回之前在多个存储过程中开始使用新的异步等待功能,但尚未能使它在目前的工作中发挥作用。
我做错了什么?实体存储过程/函数导入不可能实现异步功能吗?谢谢你的建议。
'context.customStoredProcedure(id)'静态有什么类型? – usr 2013-02-24 14:13:55
系统。Data.Entity.Core.Objects.ObjectResult –
blueFish
2013-02-24 14:40:40
你有没有得到它的工作?我与Stored Proc有同样的问题需要ASYNC。 – 2013-11-11 20:02:26