Reputation: 5629
This is my first question, be gentle :). Im working on a project with some kind of distributed architecture.Im trying to do the following:
I have a Data Access Layer that uses LINQ2SQL
I have a Service Layer that is a proxy for the Data Access Layer.
I have a Business Layer that calls the Service Layer for Entities.
The question is how can I transfer those LINQ2SQL entities to my business Layer?
I want to modify those objects on the business layer and make the travel back with the service layer and re-transform them to LINQ2SQL entities to persist the changes in the DataBase.
Im sorry if Im asking for some imposible, but Im trying to figure out the beest way but I cant get something intelligent myself :)
Best Regards!
Upvotes: 1
Views: 1256
Reputation: 6795
It sounds like you need NHibernate or some other more advanced ORM.
Upvotes: 0
Reputation: 1048
Sounds to me like you have 2 different context, the BusinessLogic context and the data access domain. You probably need a transformer/context mapper to convert from one onto another and vice versa.
public class ContextMapper { public BusinessLogic.Customer Convert(DataAccess.Customer customer) {
} public DataAccess.Customer Convert(BusinessLogic.Customer customer) {
}
You could also write these as extension methods if you like
}
Upvotes: 3