v3 - adapter, Extending Entity class

Posts   
 
    
miloszes
User
Posts: 222
Joined: 03-Apr-2007
# Posted on: 31-Jan-2011 10:22:50   

Hello,

Is it possible, to extend an Entity class to retrieve some additional info? For example, I would like to retrieve an aggregate value.

select O.*, count(1) as "cnt_1", count(2) as "cnt_2"
from ...
inner join...

In this pseudo example I would like to fetch OrderEntity and additionally count of some other objects. As a result of the method I need to return only a collection of OrderEntity (with other objects prefetched) but i also need that count for some business operation in the method.

Best Regards, MiloszeS

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 31-Jan-2011 12:57:45   

You can use a projection (this is for a custom class, but you can also project onto an entity using the entity projector class) or use a linq query when projecting the linq result onto an entity instance: var q = from o in metaData.Order ... select new OrderEntity() { ... }

Frans Bouma | Lead developer LLBLGen Pro