What objects should contain database access methods in domain design

I thought that the domain-driven design says that the Get methods are in the repositories, and the Add / Del / Update is in the business objects?

Can you please clarify this?

When I look at the MVCMusicStore sample, all CRUD methods in the database are in entities ?!

http://mvcmusicstore.codeplex.com/SourceControl/changeset/view/d9f25c5263ed#MvcMusicStore%2fModels%2fShoppingCart.cs

+1
source share
3 answers

? ( Does "" -?) - , DDD Active Record vs. Repository.

, . DDD , . DDD . , .

, DDD , Active Record Repository .

+1

, , , , MVC. , , - .

, -. , ( a.k.a.) .

+1

Here a typical repository looks like this:

public class OrderRepository {
    public MyClass Load(Guid id); // throws an exception if not found
    public void Save(Order order);
    public void Delete(Guid id); // does not throw an exception if not found (idempotent)
}
0
source

All Articles