EF Core: ValueGeneratedNever() vs. not using this method at all

c# entity-framework entity-framework-core

Question

What is the point of explicitly telling entity framework not to generate a value for a field in a database? There are two other options which are ValueGeneratedOnAdd or ValueGeneratedOnAddOrUpdate that make sense but does the framework by default generate a value so I have to disable it manually through that method? If it does not, what is the ValueGeneratedNever() exactly for and what is the advantage of it?

1
3
10/28/2016 8:41:42 PM

Accepted Answer

For example, when you want to have manually assigned primary keys, you need to call this method. By convention, EF will assume that primary key properties are automatically generated.

3
10/28/2016 10:14:10 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow