I am using dapper.rainbow for inserting a record into MSSQL db. Following is my code
int? id = db.RoomTypes.Insert(roomType)
When i run my app, i am getting the below exception.
Cannot insert explicit value for identity column in table 'RoomTypes'
when IDENTITY_INSERT is set to OFF.
I think that dapper.rainbow is using the value (default value for int) for my Identity Column during the insert. This is what causing this exception. My identity column for the table RoomTypes
is auto incremented and it is also the primary key of my table.
Now, how do i stop the dapper.rainbow from using the ID column during insert.