Finding entities with Identity sequence PKs

Posts   
 
    
simmotech
User
Posts: 1024
Joined: 01-Feb-2006
# Posted on: 25-Apr-2012 09:54:51   

Is there an easy way of checking whether an entity type (not instance) has a PK with an identy sequence? From non-DAL code?

Cheers Simon

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 25-Apr-2012 19:09:05   

None in Adapter. In Selfservicing: ((IFieldPersistenceInfo)field).IsIdentity

simmotech
User
Posts: 1024
Joined: 01-Feb-2006
# Posted on: 26-Apr-2012 11:28:12   

Walaa wrote:

None in Adapter.

OK, how about a hard way. smile : (I don't mind using reflection if I have to, I just don't know where to reflect to)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 26-Apr-2012 16:41:27   

In adapter, the information isn't in the field, it's in the persistenceinfo object, which isn't available in the entity (only through the adapter). In selfservicing, this info is in the field, so it's available.

So if you're using adapter, you have to ask the adapter (using the getfieldpersistenceinfo methods, which are protected) the fieldpersistenceinfo object and then check the flag.

Frans Bouma | Lead developer LLBLGen Pro