EF4 Code First make tables names singular

后端 未结 2 1176
迷失自我
迷失自我 2021-01-01 23:09

I\'m using standards for singular table names. EF4 Code First has by default to pluralize table names. I have put the code to override this convention, but seems is not work

相关标签:
2条回答
  • 2021-01-01 23:59

    I our current project we had the same problem. I wrote about it in another question, but here it is:

    Entity Framework v4 and underscores in column names

    It's a little more complex than expected.

    HTH

    0 讨论(0)
  • 2021-01-02 00:00

    Your using the wrong convention. You need to do the below.

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {    
        modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
    }
    
    0 讨论(0)
提交回复
热议问题