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!
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
}