Reputation:
I am working on WinRT and entity framework (to SQL), the layer that communicates between them is WCF Service.
In the entity framework I am using the Repository Pattern and I have the method:
public IQueryable<User> GetBySearch(Expression<Func<User, bool>> search)
{
return this.Context.Users.Where(search);
}
Everything works fine, but when I add it to WCF
[OperationContract]
IQueryable<User> GetEventBySearch(Expression<Func<User, bool>> search);
and:
public IQueryable<User> GetEventBySearch(Expression<Func<User, bool>> search)
{
IUser user = new UserRepository();
return user.GetBySearch(search);
}
But the problem that Expression<TDelegate>
is not serializable, therefore, WCF can't serialize it.
So I thought to inherit from it and make it [Serializable]
but the problem that it is a sealed class.
Upvotes: 0
Views: 637
Reputation: 147
This doesn't make sence at all. In fact you try to execute a func in the code of WinRT client on the WCF service. How shoud that work? I think you have to define your own query language that is translated to a expression on the service.
Upvotes: 1