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>();    
}
}

No comments:

Post a Comment