Sybase ASE 15 - sp_primarykey and sp_foreignkey

Posts   
 
    
frn6
User
Posts: 2
Joined: 21-Dec-2011
# Posted on: 22-Dec-2011 10:48:19   

Hi, I apologize if my question appears to be stupid, but i am a complete newby to O/R mapping and to LLBLGen Pro... flushed I'm working for a client that uses Sybase since the beginning of time, with databases that have been migrated along multiple versions of Sybase, now on ASE 15, and am currently facing a physical primary key problem. In the old times, sp_primarykey and sp_foreignkey where used to declare keys, but where never introducing any constraint. These are purely documentation features, that are not correlated with physical keys. Database Integrity is managed via triggers or other ways... From the documentation, i see that LLBLGen Pro 3.1 support "model only" relations, as logical foreign keys, sort of... Is there any way to create model only primary keys, that will never be needed in the physical schema ? For my evaluation, i had to build a separate empty database, using an exported DDL, and apply some scripts to physically create keys (primary and foreign) so that the Designer feel happy to generate some interesting code. That's somewhat cumbersome...

Of course, i cannot change anything in the underlying production DDL. Have you any advice to share about this that could help me to industrialize the modeling / code generation process ? disappointed

frn6
User
Posts: 2
Joined: 21-Dec-2011
# Posted on: 22-Dec-2011 17:02:38   

Ok, i will give this a try :

IdentifyingFieldsFollowDBPrimaryKeyConstraints set to false,
UniqueConstraintsFollowDBUniqueConstraints set to false,
identifying fields manually set in model (reflecting sp_primarykey)
with all relations manually (reflecting sp_foreignkeys) set to model only.

and see if i find a better way...

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Dec-2011 06:13:44   

Yes, that's the way to create model-only relationships and identifying fields. For PK: as long as they are not nullable at db, you can pick them up in the identifying fields dialog. For model-only relationships: the fields on both sides must have the same type and the PK-side fields should be part of the 'identifying fields' set (primary key).

David Elizondo | LLBLGen Support Team