How is a delete of an aggregate root handled in DDD?

I have two an aggregate root referencing another aggregate root (first references the second via the identity of the second aggregate root).

A command from my application layer (via MVC asp.net) now deletes my second aggregate root.

At the point of deleting the root, do I send a Domain Event telling the first aggregate root to "NULL" the reference to the second aggregate which now does not exist?

JD

-------------Problems Reply------------

You're going about it the wrong way. Step back from the technical issue you are facing. First of all I doubt there is such a thing as "Delete" in your ubiquitous language. Most likely people will call it "archive", "taking out of order", "remove", "out of stock", ... some term that denotes that a particular aggregate is at the end of its life-cycle. When domain experts speak of such things, this should be a trigger for you to ask them a question along the line of : "Well if you discontinue a Product, how will that affect a Promotion for that particular Product?". To correlate back to your issue: Promotion being the aggregate that holds a reference to the Product aggregate. So it very much becomes a business issue rather than a technical one. Most of the time business people already have a process in place that prevents this technical issue from happening in the first place (e.g. you can't discontinue a Product that's being used in a Promotion). I hope it's clear by now that giving you a generic answer is not an option.

Category:domain driven design Views:1 Time:2011-12-20

Related post

  • Fluent NHibernate cascading delete convention for aggregate roots 2010-11-07

    Question is: how to write convention that prevents deleting entity reference if it inherits from type Root? I'm using fluent nhibernate and it's auto mapping feature. Turned on cascading delete by default. Everything was really cool until I finally h

  • How should I enforce relationships and constraints between aggregate roots? 2011-05-24

    I have a couple questions regarding the relationship between references between two aggregate roots in a DDD model. Refer to the typical Customer/Order model diagrammed below. First, should references between the actual object implementation of aggre

  • Getting all aggregate root entities child entities? 2011-09-18

    I am attempting to refactor my application from a repository per entity to a repository per aggregate root. A basic example would be I have an entity root of Cars. Cars have hire contracts. As far as I can see contracts don't exist without cars hence

  • How does an aggregate root delete one of its children? 2009-11-12

    If my understanding of Aggregate Roots is correct, the root should be responsible also for deleting one of its "children". That would seemingly translate into something like this: order.removeOrderLine(23); Which would effectively remove it from the

  • Delete Child Object From Aggregate Root With EF Repository 2012-02-03

    My original question is here. Below is my updated code. Public Function StockTransferItemRemove(removeRequest As StockTransferItemRequest) As StockTransferItemResponse Implements IStockTransferService.StockTransferItemRemove ' create your objects Dim

  • Detecting Changes in Entities within an Aggregate Root 2009-09-14

    I am looking to see what approaches people might have taken to detect changes in entities that are a part of their aggregates. I have something that works, but I am not crazy about it. Basically, my repository is responsible for determining if the st

  • DDD/NHibernate Use of Aggregate root and impact on web design - ex. Editing children of aggregate root 2009-11-21

    Hopefully, this fictitious example will illustrate my problem: Suppose you are writing a system which tracks complaints for a software product, as well as many other attributes about the product. In this case the SoftwareProduct is our aggregate root

  • Aggregate roots. How far does the rabbit hole go 2010-01-22

    I'm trying to use the Repository pattern for my current project and i'm currently in the process of trying to model the domain and find the aggregate roots. I've read of the 'Cascading Delete' rule which states that if it doesn't make sense to delete

  • DDD and distinction between Entity and Value object. Choosing the aggregate root 2010-03-21

    I am design and EMR. I have determined the central object to the domain is the Patient. The patient must have the following a Doctor and Medical Records. Medical Records is a grouping term refering to the collective of Encounters, Labs, XRays, Prescr

  • DDD: Address as an aggregate root? 2010-07-13

    I’m struggling designing this system where an address is the most central piece of information. Now in this case, an address is not just a few lines of strings. We’re storing municipalities (code, name), district (post code, name), streets (code, nam

  • multiple aggregate root creation in one single transcation in CQRS 2010-09-12

    I would like to know how multiple aggregate root are created in CQRS. Example: I have a handset aggregate root and Simcard aggregate root. The id from these aggregate should be part of subscription aggregate root . i need to create a Subscription agg

  • Please clarify how create/update happens against child entities of an aggregate root 2011-01-10

    After much reading and thinking as I begin to get my head wrapped around DDD, I am a bit confused about the best practices for dealing with complex hierarchies under an aggregate root. I think this is a FAQ but after reading countless examples and di

  • Database Table Schema and Aggregate Roots 2011-01-15

    Applicaiton is single user, 1-tier(1 pc), database SqlCE. DataService layer will be (I think) : Repository returning domain objects and quering database with LinqToSql (dbml). There are obviously a lot more columns, this is simplified view. LogTime i

  • Aggregate roots depend on the use case so does that mean that we might end up with really a lots of repositories? 2011-02-01

    Ive heard a lots that aggregate roots depend on the use case. But what does that mean in coding context ? You have a service class which offcourse hold methods (use cases) that gonna accomplish something in a repository. Great, so you use a repositor

  • How do you create an audit trail for aggregate roots? 2011-05-14

    I have read several articles online as well as several answers on StackOverflow about creating an audit trail for a database driven application. It seems that the most popular solution is to create an audit table for the table in question and use tri

  • How can an ASP.NET MVC Action method access sub entities of an aggregate root? 2011-05-17

    I'm having trouble understanding how one would access the sub entities of an aggregate root. From answers to my previous question I now understand that I need to identify the aggregate roots of my model, and then only setup repositories which handle

  • Defining boundaries and communicating between aggregate roots 2011-05-19

    I could use some help understanding my domain model a bit and making sure I am approaching the design correctly. I have an aggregate root called Department. The Department object has several child value types that help define the business notion of a

  • How do public websites built using DDD keep from having one main aggregate root 2011-05-23

    I'm trying to use domain driven design while creating a website that is publicly accessible. One problem I'm having is trying to figure out what the aggregate roots should be for my model. I have a pretty good idea of what objects are entity objects

  • Help determining aggregate roots 2011-09-08

    I am stuck in a vortex of analysis paralysis trying to apply DDD to various applications i have either developed in the past or plan on doing in the future. Lets take for example a simple softball league. We have leagues, teams that belong to a leagu

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.168 (s). 11 q(s)