Projecting onto EntityCollections

Posts   
 
    
Posts: 30
Joined: 17-Sep-2006
# Posted on: 14-Sep-2007 17:59:00   

Hi everyone,

Sorry, another question for you! I'm using the following code to create a set of projectors so I can project onto an entity collection, as I need to have a groupby/having clause - even though the resultset itself is just the entity fields:

List<IDataValueProjector> valueProjectors = new List<IDataValueProjector>(entityFields.Count); foreach (EntityField2 entityField in entityFields) { valueProjectors.Add(new DataValueProjector(entityField.Alias, entityField.FieldIndex, entityField.DataType)); } DataProjectorToIEntityCollection2 projector = new DataProjectorToIEntityCollection2(entityCollection);

da.FetchProjection(valueProjectors, projector, entityFields, relations, 0, null, groupByClause, true, 1, 10);

which works great. Except when one of the columns in the entity is an integer column set up to automatically convert to an enum. Is there any way to do this, without getting in to a whole load of special cases building up a projection that ideally I shouldn't be having to build in the first place?

Cheers

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 15-Sep-2007 11:58:03   

Projections don't use type converters themselves. If you want to, you have to create a derived class of the datavalueprojector class.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 30
Joined: 17-Sep-2006
# Posted on: 17-Sep-2007 18:02:24   

Frans - is there any way at all that we could have a parameter for FetchEntityCollection with a groupBy clause? The lack of one is the only reason I'm having to use a projection, and I'm loathed to have to go and implement further special cases that might bite me again later if I can avoid it?

Would appreciate your thoughts on this!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 17-Sep-2007 20:38:06   

It's not logical to have a groupby clause. The thing is: an entity is represented by a table row/view row in one or more tables/views. A query result of a groupby is a new set, it's not a set in a table/view, so you then actually are mapping your entity onto a set resulted from a group by instead of a table/view.

In v2.6, we'll introduce derived tables, (select * from (select * from ... )), which would allow you to create a set with groupby and use that as the source for an entity fetch. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Posts: 30
Joined: 17-Sep-2006
# Posted on: 18-Sep-2007 15:13:17   

Ah, thanks Frans - it's the derived table scenario that I need here! simple_smile

Max avatar
Max
User
Posts: 221
Joined: 14-Jul-2006
# Posted on: 19-Sep-2007 10:18:15   

Otis wrote:

In v2.6, we'll introduce derived tables, (select * from (select * from ... )), which would allow you to create a set with groupby and use that as the source for an entity fetch. simple_smile

Fantastic! sunglasses

Posts: 30
Joined: 17-Sep-2006
# Posted on: 19-Sep-2007 13:46:36   

Cheeky question - when is 2.6 due out? wink

Continuing to be impressed by LLBLGen... and the quality of the support. Keep it up guys!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 19-Sep-2007 14:14:11   

james.crowley wrote:

Cheeky question - when is 2.6 due out? wink

Aren't you the one doing stand-up comedy on friday nights? wink sunglasses . When it's released, I have no idea, but it won't take 9 months like 2.5 did simple_smile I'm currently busy designing the derived table stuff, I hope to have something working by the end of the day. After that, Linq support is going to be more straight forward. (I hope wink ). We're only planning to add Linq support, some Api changes for bugfixes and stuff supporting Linq and that's it. So no other features will be added.

Continuing to be impressed by LLBLGen... and the quality of the support. Keep it up guys!

Thanks! smile

Frans Bouma | Lead developer LLBLGen Pro