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

时间:2017-02-21 23:02:31

标签: c# asp.net-mvc

我正在尝试为我的" Bookservice"启用迁移功能。项目但遇到以下错误,我该如何找出问题所在?

要为BookService.Models.BookServiceContext'启用迁移,请使用Enable-Migrations -ContextTypeName BookService.Models.BookServiceContext。

BookServcieContext.cs

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace BookService.Models
{
    public class BookServiceContext : DbContext
    {
        // You can add custom code to this file. Changes will not be overwritten.
        // If you want Entity Framework to drop and regenerate your database
        // automatically whenever you change your model schema, please use data migrations.
        // For more information refer to the documentation:
        // http://msdn.microsoft.com/en-us/data/jj591621.aspx
        public BookServiceContext() : base("name=BookServiceContext")
        {
        }

        public System.Data.Entity.DbSet<BookService.Models.Author> Authors { get; set; }
        public System.Data.Entity.DbSet<BookService.Models.Book> Books { get; set; }
    }
}

0 个答案:

没有答案