linq to sql - Struggling with DDD, Repository Pattern, and Associated Domain Models -


I'm really struggling to wrap my head around some of these things. Let me tell an example of where I am struggling.

I am using Linp-2-Sql IRAP opoperatory pattern used in MVC storefront sample app from DAL and Rob Conery for my app. / P>

In my domain, I have a customer model in which there is a collection of address models. My UI has a button that allows the user to add a new address to the customer. It opens an address editor that lets them fill in all the information.

What happens next? Does the address database be saved, then my client is added to the list in the object? Is it only added to the list, but not updated until the customer object is saved? What if the user wants to remove an address? Do I remove the address in the database and then remove it from the list? Or do they add / delete all that they want and I always put everything from the database and update everything I do in the customer. Collection Archive? What is the correct flow here?

Whether the address collection should be updated only through the repository by calling it:

  Public Zero AddAddressToCustomer (Customer C, address one) {// Validate and add new saved address to db / customer object to save address}  

Help ...

DDD is an area where I have lots of interest but very little experience, please help me Discharge behavior of caution I offer only due to the absence of other, more authentic, north.

Eric Evans is given the address as' some example which should be generally considered as a commodity object unit. Therefore, I believe the ad will be of the customer:

Customer. Add (address);

There will be a customer repository (but not one for address) This can be used as:

customerRepository.Update (customer);

The intentional effect is that you ask all the difficult questions that this is not how it concerns DB layer domain objects (i.e. customer object). I am afraid that I can not help beyond that point.


Comments