域上下文加载
我尝试通过域服务(异步)在如下代码行中加载实体:
context.Load<Book>(
context.Books.Where(b => b.BookID == 1),
(s, e) =>
{
_book = e.Results;
},
null);
但出现以下错误: 类型“SilverlightApplication1.Book”不能用作泛型类型或方法“System.ServiceModel.DomainServices.Client.DomainContext.Load(System.ServiceModel.DomainServices.Client.EntityQuery, System.Action>,”中的类型参数“TEntity”目的)'。没有从“SilverlightApplication1.Book”到“System.ServiceModel.DomainServices.Client.Entit”的隐式引用转换
如何修复?
I tried to load a entity by domainservice(async) in on line of code like:
context.Load<Book>(
context.Books.Where(b => b.BookID == 1),
(s, e) =>
{
_book = e.Results;
},
null);
But I got following error:
The type 'SilverlightApplication1.Book' cannot be used as type parameter 'TEntity' in the generic type or method 'System.ServiceModel.DomainServices.Client.DomainContext.Load(System.ServiceModel.DomainServices.Client.EntityQuery, System.Action>, object)'. There is no implicit reference conversion from 'SilverlightApplication1.Book' to 'System.ServiceModel.DomainServices.Client.Entit
how to fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用 EntityQuery,查看您的堆栈跟踪,它给出了解决方案。
在您的 DomainService(在服务器上)实现方法“GetBookById”:
像这样加载数据:
you neet to use EntityQuery, look at your stack trace it is give solution.
implement method 'GetBookById' at your DomainService (at the server):
And then load data like this: