I have a table in a SQL Server database which I want to add a row to. The primary key is not auto increment and I don’t want it to be. However, on this occassion, I do want to add a row with the next available value. Is there a simple way to do this? I know I could query the table for the max value and then increment it but is there an easier way when using EF?
If a separate query is neccessary getting the MAX value how would you do this with LINQ?
It would be necessary unless the server is identity or computed column, in such a case you could do something like below.