Is it possible to set an EF6 model's primary key value?

82 Views Asked by At

In Entity Framework 6, when a Model has a [Key] field defined, is it possible to set this value manually, or will the DbContext always set this value itself?

I have done some research, and I cannot quickly find this answer. First I thought that this is possible, tried to set the id in a Create ActionResult, and the id was still added as an increment on the last added DbSet object.

Hence this question.

Thanks

0

There are 0 best solutions below