IDENTITY INSERT and LINQ to SQL
I have a SQL Server database. This database has a table called Item. Item has a property called "ID". ID is the primary key on my table. This primary key is an int with an increment value of 1. When I attempt to insert the record, I receive an error that says: Cannot insert explicit value for identity column in table 'Item' when IDENTITY_INSERT is set to OFF.". I am attempting to insert records using the following code: public int AddItem(Item i) { try { int id = 0; using (DatabaseContext context = new DatabaseContext()) { i.CreatedOn = DateTime.UtcNow; context.Items.InsertOnSubmit(i); context