Re: CQRS cross aggregate interaction + private state
rogeralsing <roger.alsing <at> precio.se>
2010-02-09 13:31:26 GMT
Ah, ofcourse, it's how the old MUD games works
player.Eat(apple);
apple.CanBeEaten(player);
I knew this, just wanted to see if your all awake *jk*
--- In domaindrivendesign <at> yahoogroups.com, Nuno Lopes <nbplopes@...> wrote:
>
> Maybe I can help:
>
> class Product : IOrderableItem
> ....
> void TestAddOrder(Order order, double qty)
> {
> if (this.IsObsolete())
> throw new BusinessException("An obsolete product cannot be ordered")
> }
>
> void Order (Order o, double qty) {
> o.AddItem(this, this.REF, this.Description, this.Price, qty)
> }
> .....
>
> class Order
> {
> void AddItem(IOrderableItem i, string REF, string description, double price, double qty)
> {
> ...
> i.TestAddOrder(this, qty)
> ......
> this.DoAddItem(new OrderLine(REF, description, price, qty));
> }
> }
>
> Hope it helps.
>
> Nuno
>
>
> On Feb 9, 2010, at 12:38 PM, rogeralsing wrote:
>
> > If entities only have private state, how do you deal with interaction between aggregates?
> >
> > e.g.
> >
> > product = GetProduct(123);
> > order.AddProduct(product,3);
> >
> > Lets for the sake of the argument that addproduct can not occur if product is marked as obsolete.
> >
> > How would you deal with that?
> > What's the idea behind completely private state?
> > Why shouldn't order be able to read properties on product?
> >
> >
>
------------------------------------