Entity Framework throws exception - Invalid object name 'dbo.BaseCs'

后端 未结 12 929
挽巷
挽巷 2020-11-30 11:59

I\'ve followed Adam\'s answer here and the Entity Framework now works and the Seed() method also works.

But when I try to access the database l

12条回答
  •  渐次进展
    2020-11-30 12:36

    If you are providing mappings like this:

     protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new ClassificationMap());
            modelBuilder.Configurations.Add(new CompanyMap());
            modelBuilder.Configurations.Add(new GroupMap());
            ....  
        }
    

    Remember to add the map for BaseCs.

    You won't get a compile error if it is missing. But you will get a runtime error when you use the entity.

提交回复
热议问题