9 Feb 14:02
Re: CQRS cross aggregate interaction + private state
Nuno Lopes <nbplopes <at> gmail.com>
2010-02-09 13:02:16 GMT
2010-02-09 13:02:16 GMT
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)
......
div>
__._,_.___
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?
__._,_.___
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
RSS Feed