在程序集“OnlineShoppingStore”中找到了多个上下文类型

时间:2017-09-22 11:58:47

标签: c# entity-framework

我正在尝试为我的“OnlineShoppingStore”项目启用迁移,但遇到以下错误,我该如何找出问题所在?

  

要启用“BookService.Models.BookServiceContext”的迁移,请使用Enable-Migrations -ContextTypeName OnlineShoppingStore.Models.EFDbContext。

namespace OnlineShoppingStore.Models
{
    public class Product
    {
        public int ProductId { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public decimal Price { get; set; }
        public string Category { get; set; }
    }

    public class User
    {
        public string UserId { get; set; }
        public string Password { get; set; }
    }

    public class EFDbContext : DbContext
    {
        public EFDbContext()
            : base("EFDbContext")
        {
        }

        public DbSet<Product> Products { get; set; }
        public DbSet<User> Users { get; set; }
    }
}

强文

0 个答案:

没有答案
相关问题