When trying to use this code:
var model = new MasterEntities(); var customer = new Customers(); customer.Sessionid = 25641; model.Customers.Add(customer);
You can configure SQL to auto-generate (and auto-increment) the primary key for the table upon inserts. Then just remove the [Key] in C# and you don't need to set the ID in the application manually, the db will generate it for you.