The blog has moved to the new site F10Debug.com
Showing posts with label identity specification false. Show all posts
Showing posts with label identity specification false. Show all posts

Thursday, January 5, 2017

How to set identity specification set to false globally in entity framework


We can globally turn off this feature by removing StoreGeneratedIdentityKeyConvention Convention as below,

public class OurContext : DbContext 
{    
protected override void OnModelCreating(DbModelBuilder modBuilder) {        modBuilder.Conventions.Remove<StoreGeneratedIdentityKeyConvention>();    
}
}