Wednesday, January 11, 2017

How to Remove Plural table name from DbContext


 protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            Database.SetInitializer<PMContext>(null);
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            base.OnModelCreating(modelBuilder);            
        }

  modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();

by adding this line we can remove the plural table name from DbContext

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software