I have a service with a domain model and I want to expose data to clients. The service has a typical architecture: a database, ORM (EF), a business layer with a domain model.
I want to use WCF DataServices to provide data to clients, but I cannot send data objects from the domain model to the client. I am going to use DTO to interact with clients, and I have a dto <=> data object mapping.
DataServices has a reflection provider, which in this case seems great (letβs consider a read-only script). But the reflection provider requires the IQueryable<dto> property, which must be set. And that is the problem. Therefore, I see the following ways to solve it:
- Download all the domain objects, map all of them to dtos and return the result of dtos. A really bad approach if there are many domain objects.
- Create the provider "linq2dto" and create dynamically the corresponding request "linq2EF", at the point of materialization of the request, get the data from db and perform the mapping. It sounds good, but as I see it, it is a difficult task.
So guys, I need some help. I do not want to write (and support!) The new linq provider. Maybe there is some kind of "common linq2anyware" implementation that I can use?
On the other hand, I really cannot provide data objects to the client and use the DataServices EF provider. Is there an easy way to implement such a mapping?
source share