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> GetUserBySearch(Expression<Func<User, bool>> search);
and:
public IQueryable<User> GetUserBySearch(Expression<Func<User, bool>> search)
{
IUser user = new UserRepository();
return user.GetBySearch(search);
}
But the problem that Expression 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.
Can someone help me to solve the problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…