Description
I understand that RepoDB does not natively support the SQL Server SET IDENTITY_INSERT ON | OFF
operation because it is vendor-specific. However, if I have manually enabled Identity Insert on the current connection, how can I actually set the identity value when inserting an entity into my SQL Server database? I'm getting the following error when performing the insert:
Microsoft.Data.SqlClient.SqlException
HResult=0x80131904
Message=Explicit value must be specified for identity column in table '<TableName>' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.
Source=Core Microsoft SqlClient Data Provider
I can see that RepoDB runs a query to obtain the column metadata the first time an entity is used. One of the metadata values returned by this query is 'IsIdentity'. I'm guessing that this metadata value is then used to determine whether an explicit value for a field should be included in the INSERT statement sent to the database.
Is there a way to tell RepoDB to override the default behaviour for a specific operation and allow identity inserts?