Re: AR + DDD Properly Deleting Objects

2008-10-28 Thread Markus Zywitza
Try with Cascade = ManyRelationCascadeEnum.AllDeleteOrphan And consider removing the BelongsTo completely. There is normally no need to navigate from Item to ShoppingCart. Here is my mapping for a similar model: [ActiveRecord] public class ShoppingCart { private Guid id; private string

Re: AR + DDD Properly Deleting Objects

2008-10-28 Thread Markus Zywitza
Make sure that you have ColumnKey and Table properties specified in the HasMany attribute. They are necessary, but will be inferred when a corresponding BelongsTo is found. -Markus 2008/10/28 [EMAIL PROTECTED] [EMAIL PROTECTED] I get an error that the belongsto is missing when I remove it.

Re: AR + DDD Properly Deleting Objects

2008-10-28 Thread Markus Zywitza
Another point: When you use SessionScope in the UT, you have to manually flush the scope before testing if someone changed in the DB. AutoFlush is currently broken due to NH2. I'm working on that but I'm kinda stuck there... :-( -Markus 2008/10/28 [EMAIL PROTECTED] [EMAIL PROTECTED] I get an

Re: AR + DDD Properly Deleting Objects

2008-10-28 Thread Markus Zywitza
That's easy: Create an CartRepository that knows about AR and let it have a DeleteItem(CartItem item) method. If you are purist, create ICartRepository in the domain layer and ARCartRepository in the persistance layer, and match them with IoC. ICartRepository then defines DeleteItem(CartItem

Re: AR + DDD Properly Deleting Objects

2008-10-28 Thread Victor Kornov
btw, is there a reason for that other than AR/NH being incapable (or we) to do that simpler way (i.e. just detaching it from relevan aggregate root)? On Wed, Oct 29, 2008 at 1:07 AM, Ken Egozi [EMAIL PROTECTED] wrote: create ICartRepository in the domain layer and ARCartRepository in the

Re: AR + DDD Properly Deleting Objects

2008-10-28 Thread [EMAIL PROTECTED]
Just as some background, I do have ICartRepo and CartRepo (I've been oversimplifying everything). The model classes handles the logic (calculating prices, update quantity, delete item, emptycart, etc.) and the repo saves things when I'm done. This is where it gets really confusing for me. IMHO

Re: AR + DDD Properly Deleting Objects

2008-10-28 Thread [EMAIL PROTECTED]
just grabbed this from the codecampserver trunk ... Add Sponsor public virtual void AddSponsor(Sponsor sponsor) { _sponsors.Add(sponsor); } Remove Sponsor public virtual void RemoveSponsor(Sponsor sponsor) {