Get Primary Key Field of a typed view

Posts   
 
    
avo
User
Posts: 9
Joined: 06-Jan-2012
# Posted on: 10-Jun-2013 13:03:38   

Hello,

I've just migrated my application from LLBLgen v3.5 to v4.0.

In LLBLGen v3.5 the “typedList.GetFieldsInfo.PrimaryKeyFields” returned the list PrimaryKeyFields used in the Typed List (selected PrimaryKey Fields from the Entities used in the typed List).

Now with the version 4.0 the PrimaryKeyFields-Property always returns an empty collection.

Why?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 10-Jun-2013 16:15:51   

Because PrimaryKeyFields is a property which is only valid for when the fields object is in an entity. We refactored the entity fields object in such a way that values aren't stored inside the field objects themselves anymore.

We didn't anticipate that outside entities this property would be used (as it has no designed value outside entities). To mimic the property, do:

var allPkFields = typedList.GetFieldsInfo().Where(f=>f.IsPrimaryKey).ToList();

Frans Bouma | Lead developer LLBLGen Pro