When using LINQ to SQL am I forced to live with objects structured the same as the database? Or can I use a different modelling structure for my business models?
If it’s possible, how can I make this change?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can create your own business model as DTO classes and copy the content to these DTO classes from your linq to sql objects. We used T3 templates (I don’t remember where I got it…you can google it) to generate the DTOs to save the coding time and used Automapper initially to convert from L2S objects to DTOs, however, we started getting AutoMapperException randomly with no clues. So, for all our new code, we have created helper class to do the conversion. The advantage of this approach is that, now your service can be consumed by even non .NET clients as DTOs are platform generic.