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?
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: