in place of
because the Id column in your screen short has the same value. Consequently, you must do this.
Otherwise, you must verify that ID is a primary key. and 15 to zzz
is used when there are expected to be zero or more results in the input collection. If there are multiple results, the call returns the first one; if there are none, it returns the default value.
is used when there should be either zero or one result in the input collection, and the call only returns one result if there is exactly one result. Standard if no outcomes and an exception if several outcomes.
The code initial model was created with the knowledge that you reverse-engineered the database while the Id column had not yet been set to IDENTITY.
set for the entity's Id property.
When the column is changed to IDENTITY, EF creates an insert statement with the Id set as a result, which is invalid.
That settings must be manually corrected by either changing it to
Considering that it is the default value for integer fields, you could just remove it entirely.
You must alter.
this.HasKey(e => e.Id); Property(e => e.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
Edit : Please deleted your old table values and re generate it or remove same primary key rows. You should need to regenerate your
CateringServicestable values :), if the problems not cleared yet.