First of all I must mention that I haven’t tried all the news within Linq so this blog post might change over time. I will not cover how Linq works but will focus on Linq to SQL and Linq to Objects within DDD. I choose to not talk about Linq to Entity Framework but switch from Linq to SQL to Linq to Entity Framework is not a big deal. Liten post om Linq under DDD...
In classic DDD (Domain Driven Design) we uses Repositories for our entity objects, say you got an Car and you want to get this Car from a data source of some kind you simple ask your CarReposiroty for it.
Car car = carRepository.GetCar();
If you need to get multiple cars you simple ask for that too.
IList<Car> cars = carRepositoy.GetCars();
The CarRepositoy got the access to what’s mostly know as Data Access Layer.
In .Net 2.0 we usually use ADO .Net in our Repositories or some other kind of Data Access Framework (own created a 3rd party, MS Enterprise Data Access Application Block or some kind of O/R Mapper). Because of Linq we don’t need to change our Domain only the logic used within our Repositories.
Läs vidare...
http://www.johannormen.com/blog/viewpost.aspx?PostID=228&showfeedback=true