Custom Entity Collections

Posts   
 
    
Posts: 24
Joined: 19-Oct-2006
# Posted on: 20-Oct-2006 21:48:27   

Two questions:

  1. Let's say I have an entity, Order, and want to create an OrderCollection so that I can have special properties and methods that apply to a collection of Orders, is the best way to create such a class to simply to the following?

public class OrderCollection : SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase<Order>
{
   ...
}

  1. If the above is correct, how would I then persist this collection? Would I have to cast it back to the EntityCollectionBase type or . . . . ?

If this is all wrong, do let me know. simple_smile I am only on my second day with this stuff, and while I am reading as much of the documentation as possible, I also have specific questions I really need answered immediately so that we can move this project forward.

Thanks!

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 21-Oct-2006 03:16:45   

We used to use the domain model with SelfServicing and did many things like this. We now use classes such as OrdersService to keep the logic for processing order collections. If you are wanting to add methods and properties onto entities then we still use the usercode regions or the partial classes. Hopefully someone else is able to answer you question with a similar strategy for collections.

Posts: 24
Joined: 19-Oct-2006
# Posted on: 22-Oct-2006 18:24:50   

bclubb wrote:

We used to use the domain model with SelfServicing and did many things like this. We now use classes such as OrdersService to keep the logic for processing order collections. If you are wanting to add methods and properties onto entities then we still use the usercode regions or the partial classes. Hopefully someone else is able to answer you question with a similar strategy for collections.

Well, perhaps more reading on my part will yield the answer, I was just hoping for a quick "Yes, what you propose will work" or something similar. I am sure I will figure it out, it isn't too hard of a problem I am supposing. Thanks anyway!