Hey nathan, good question.
As others have said, it's best to distract all of your GET / WRITE methods and completely hide the DataContext from your business logic.
My approach to this was to write a DAL with a bunch of common methods that use reflection to do whatever is needed.
In these cases, as soon as the method receives an object, say, βProductβ, it can do whatever it wants, regardless of you. Technology ORM / Data Access. If you want him to literally just write an SQL string based on several parameters and reflection of the object.
HOWEVER , only one will not completely undo you from LINQ to SQL.
The problem is really in the entities themselves. Even if you draw a method to retrieve data, you will still use these Entites in your business logic.
I feel that at the moment this is what Iβm ready to live with, because rewriting my own disconnected Entities seems like a bridge that Iβm not yet prepared for, simply because it is very similar to unnecessary work ...
I would be very interested to see how others handle this, though.
Hooray!
andy
source share