Entity Framework : TypedList : Custom Calculated Fields

Posts   
 
   
 
Anonymous
User
Posts: 0
Joined: 11-Nov-2006
# Posted on: 08-Jul-2016 21:10:45   

Hi there,

Using the LLBLGEN runtime it's possible to add custom calculated fields to TypedLists

http://www.llblgening.com/archive/2009/09/add-custom-calculated-fields-to-llblgen-objects/#typedlists

Unfortunately, I'm stuck with Entity Framework - is it still possible to add custom calculated fields? And if so, how do I do it?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 10-Jul-2016 09:21:15   

TypedLists in the designer are generated as Linq queries for Entity Framework. The thing is that the generated projection isn't extensible so you can't 'add' a field to it.

What you could do, but it's not that great, is copy the generated query/projection and augment it to have your custom calculation. Then derive a class from the generated typedlist poco and add a field to that derived class, and fetch the augmented query into instances of the derived class. Not ideal...

Frans Bouma | Lead developer LLBLGen Pro