Handling auto-incrementing IDENTITY SQL Server fields with LINQ to SQL in C#
- by Maxim Z.
I'm building an ASP.NET MVC site that uses LINQ to SQL to connect to SQL Server, where I have a table that has an IDENTITY bigint primary key column that represents an ID.
In one of my code methods, I need to create an object of that table to get its ID, which I will place into another object based on another table (FK-to-PK relationship).
At…