This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, My entity is set to use identity method of IdentityColumn. However, I want to be able to suppress it in code while i do an insert of a group of records where i already have specific ids (some sorta programmatic migration). I tried using the generate_id override (which seems to have the correct ids pre-save) but once the save is committed, the database records shows that it just ignores the id and had been inserted with the auto-incremented id. Is is actually possible to allow identity insert in code? Thank you. |
|
|
No this isn't possible when using the IdentityColumn approach. What you could if this is a "one-off" type concern is change your model to use KeyTable (so LightSpeed is not expecting to fetch back the identity as part of the result) and override the Id generation as you have done. In terms of setting identity insert on/off you can use UnitOfWork.PrepareCommand to associate an ADO.NET command object with the active connection LightSpeed is using and then issue those commands directly around when you are inserting the entities.
|
|