I am using a SQL Server sequence. When I tried to insert values into the database, I used the property storedGeneratedPattern
for the Id
column,
I tried it with Identity
but I get this error
(Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded)
And it tried to insert 0 to the ID column and if is there is no id with the value of 0 it insert the 0.
This error appears just when there is an id with 0, and it does not take the next sequence
I tried the storedGeneratedPattern
with computed
, but then I get this error
(Modifications to tables where a primary key column has property 'StoreGeneratedPattern' set to 'Computed' are not supported. Use 'Identity' pattern instead. Key column: 'WarehouseID'. Table: 'Erp_TestModel.Store.Warehouse)
the problem with the insert that it automatically insert 0 to the id column and not using the next value of the sequence , and if no id with the value of 0 in insert the row with 0 in the id it deals with the sequence as it is not exists