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

后端 未结 12 949
挽巷
挽巷 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:45

    If everything is fine with your ConnectionString check your DbSet collection name in you db context file. If that and database table names aren't matching you will also get this error.

    So, for example, Categories, Products

    public class ProductContext : DbContext 
    { 
        public DbSet Categories { get; set; } 
        public DbSet Products { get; set; } 
    }
    

    should match with actual database table names:

提交回复
热议问题