| 3/9/2006 12:37:05 AM |
Aggregate type attribute, something similar to a <lookup />, see psuedo example below:
<entity type="Customer" table="Customers" keyMember="id"> <attribute member="firstName" field="fistName" /> <attribute member="lastName" field="lastName" /> ... <aggregate member="orderCount" aggregateType="COUNT|SUM|MAX|etc." childFieldToAggregate="order_id" type="Order" /> ... <relation relationship="OneToMany" member="orders" field="customer_id" type="Order" ... /> ... </entity>
<entity type="Order" table="Orders" keyMember="id"> ...
This would be faster than loading the "orders" collection and calling customer.Orders.Count property I would think. Or instead of childFieldToAggregate, maybe use childMemberToAggregate or something? I realize this can be accomplished by using a View, but not all views are updateable. This member of course would be readonly.
Well aftering thinking about it more, I realize the data in said member would easily become dirty/outdated. As the OneToMany collection data changed, this aggregate member's data would not without resyncing the entity. :-(
But thought I would throw this out there anyway. It was one of those things that hit you in the shower. |