StrataFrame Forum

Override Security Business Object Primary Key Values

http://forum.strataframe.net/Topic30693.aspx

By Aaron Young - 12/7/2011

Hi,

I have hit a problem with SQL replication and the Identity primary keys on the security BOs. Is there a way of trapping when a new security record is added and replacing the primary key value in program code. Ideally, I would like to avoid doing this through a SQL default column value and handle it entirely within the application.

Thanks in advance.

Aaron
By Trent L. Taylor - 12/8/2011

Yes.  You can set the BO properties as such:

PrimaryKeyIsAutoIncremented = False
PrimaryKeyIsUpdatable = True

If you are using the DDT, you will need to check "Primary Key Is Updatable" flag for that field so that the stored sprocs for the CRUD are created correctly.
By Aaron Young - 12/8/2011

Thanks Trent.

If I use the built-in StrataFrame.Security.SecurityDialog, is there a way of intercepting new records (i.e. a permission is assigned to a role) so that I can replace the primary key?

By Trent L. Taylor - 12/8/2011

Well....not really on the client side.  You could add a trigger on the SQL table to stuff the new PK into a temp table that you then turn around and query to pull from....but that may be more energy than you are wanting to get into.
By Isabella Miller - 3/4/2012

How can we adda trigger on the SQL table?