yes 100% ok! very very common.
On Tue, Oct 9, 2012 at 7:16 PM, @nbarnwell <
mai...@neilbarnwell.co.uk> wrote:
> I'm re-reading Udi's post on Don't Create Aggregate Roots and wondering how
> far to take it.
>
> He basically says you shouldn't do stuff like this (emphasis mine):
>
> SalesOrder o = new SalesOrder();
> // Set properties, add line items etc
> repository.Save(o);
>
> but instead should accept that the SalesOrder comes from something else,
> where that "somewhere else" is responsible for "newing-up" the actual order
> object. Perhaps:
>
> Customer c = repository.Get<Customer>(message.CustomerId);
> SalesOrder o = c.PlaceOrder(message.BasketItems, message.DeliveryAddress
> ...);
> repository.Save(o);
>
> However, I'm not certain that it's appropriate in this case to say that the
> SalesOrder is actually part of the Customer aggregate, is it? If I were
> modelling this as a document in a document DB, for example.
>
> So is it okay for an AR to effectively be a factory for other ARs?
>
> Many thanks in advance,
>
> Neil.
>
> Neil Barnwell.
> Twitter: @neilbarnwell
> web:
http://www.neilbarnwell.co.uk
--
Le doute n'est pas une condition agréable, mais la certitude est absurde.