I am using this code to save a student to student table. ID is the primary key in the table.
_context.Add(student);
await _context.SaveChangesAsync();
A student object with these values works and the record is added with the next available ID in the table.
Firstname: Firstname
Lastname: Lastname
Date: {03/02/2019 23:59:00}
ID: 0
The below student object fails and causes a "DbUpdateException" Exception.
Firstname: Firstname
Lastname: Lastname
Date: {03/02/2019 23:59:00}
ID: 66 (or any other int value that isn't already used in the table)
Is it not possible to specify a value for a Primary Key in EF? Or is there a particular way of specifying a user value?