Domain Managed Design Considerations

After reading a project based on Dr. Eric Evans, I have a few questions. I searched but did not find where I could find satisfactory answers. Please let me know if you have a clear understanding of the questions below.

My problems -

  • The repository is designed to receive existing aggregates from a database, a web service. If so, Can Repository also has transactional calls for this object (i.e., Transfer amount, sending account information ... etc.)

  • Entity has methods that have business logic in which it calls Layer services to send emails. Magazines etc. (Entity methods calling IS direclty services).

  • Storage implementations and Factory classes will be in the Infrastructure Level. is this the correct statement?

  • Can a user interface (controller) directly call Repositry methods? or should I name them from the application level?

There is still a lot of confusion in my mind ... please help me ... Books in which I use Eric Evan ... .NET with C # domain support

+5
source share
3 answers
  • There is much debate about whether repositories should be read-only or allow transactions. DDD does not dictate any of these views. You can do both. Read-only repository supporters prefer Unit of Work to all CUD operations.

  • ( ) , -. , - . , Service, Entities.

  • , ( ) . , , .

  • DDD , . Relaxed Layering, , , . , , .

+13
  • DDD- , NHibernate. UoW ctor , , .

  • , , DDD, - " ". - Udi Dahan DomainEvents ( ). StructureMap . .

  • , , .

  • ! - DDD, / (ASP.NET/ASP.NET MVC), .

+9
  • , - - . :

    repository.TransferAmount(, toAccount);//

  • , , , . .

  • Yes, you put the repository implementation at your infrastructure level.

  • Can a user interface (controller) directly call Repositry methods? or should we call them from the application level?

Yes, I try to follow this pattern for the most part:

[UnitOfWork]
public ActionResult MyControllerAction(int id)
{
    var entity = repository.FindById(id);
    entity.DoSomeBusinessLogic();
    repository.Update(entity);
}
+1
source

All Articles