Using EF over WCF
How can I expose an Entity Framework IQueryable<T>
over WCF?
I'm thinking of writing an N-tier application framework and I would like to use Entity Framework and WCF.
I am aware of WC开发者_开发技巧F Data Services, but I do not want REST or HTTP. This is because I want to have bidirectional communication between the clients and the server.
Right now, it will be WinForms/WPF and ASP.NET applications will consume the services.
It seems like you may be looking for WCF RIA Services or WCF Data Services
Take a look at WCF Data Services / OData. In particular, I think this video shows an example of what you are trying to do.
You could to write the query handling for yourself similar to what the already mentioned Data Services do. Unfortunately you can't serialize LINQ queries, but you can probably serialize LINQ expressions. Check the answer to Serializing and Deserializing Expression Trees in C#.
Another option would be to offer a specific service contract with parameters for every query that you need to make.
精彩评论