After I produce a new entity within the EF utilizing a model produced from the database which i already produced in SQL Server, clearly I've a choice to create the entity's ID(Primary Key) inside my code although proclaiming the brand new entity.

For instance after i produce a new demonstration of my 'Value' table during my code such as this:

Value newValue = Value.CreateValue(int valID);

I pass inside a number say 12 to valID:

Value newValue = Value.CreateValue(12);

however when I look into the Value table's data in SQL Server the main key value valID for that new entity is designated to something apart from 12, for instance 7. Why happening?

Thanks ahead of time.

See if most of your type in the database is to establish as AUTONUMBER (In Enterprise Manager visit Design way of a table and appearance column qualities). This means the database will disregard whatever value you're passing and generate primary key itself.