Sunday 15 March 2015

sql - EF pluralize table's name on generating database from model -


I have some models and tables in EF that you can see one of them:

option model

Now when I want to create a database from the model, it's named after ' Adds tables in generated SQL:

  Make Table [DBO]. [Option] ([ID] IITIT (1,1) NULL, [Name] Encryption (50) Noel, [value] is not an integer);   

I also disabled plural versions of its name, but nothing changed:

 Enter image details here

Due to deployment of web application there are errors. How can I stop pluralism? "post-text" itemprop = "text">

Just override the OnModelCreating method and remove "PluralizingTableNameConvention"? ??? the seminar. So you are telling the Antrim Framework that do not notify the names of the table, just

upgrade

  safe override zero OnModelCreating (DbModelBuilder ModelBuilder) {modelBuilder.Conventions. Remove & lt; PluralizingTableNameConvention & gt; ); }   

This will remove a polarized conference that is linked to all model builders by default

In addition to this you must add a namespace

 < Code> System.Data.Entity.ModelConfiguration.Conventions;   

Hope this will help

No comments:

Post a Comment