0
我已经升级到我的MVC应用程序中的EF6。MVC更新数据库,升级到EF6后启用迁移问题
当我在PM控制台中尝试Enable-Migrations
。
没有上下文类型的组件中发现“Cardsender02”
我只有一个项目的解决方案,因为我看到它我有一个背景。
namespace Cardsender02.Models
{
public class CardContext : DbContext
{
public CardContext()
: base("DefaultConnection")
{}
然后我尝试
Enable-Migrations -ContextTypeName Cardsender02.Models.CardContext
但是,这给了我
类型 'Cardsender02.Migrations.Configuration' 不从 “System.Data.Entity.Migrations继承。 DbMigrationsConfiguration”。迁移 配置类型必须从 'System.Data.Entity.Migrations.DbMigrationsConfiguration'扩展。
现在该怎么办?
配置类:
namespace Cardsender02.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<Cardsender02.Models.CardContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(Cardsender02.Models.CardContext context)
{}
}}
您需要一个继承自'DbMigrationsConfiguration'的类来处理您的上下文。 – DavidG 2014-09-04 10:27:40
我看不懂,请在添加代码时更新您的问题:) – DavidG 2014-09-04 10:30:13
@ThorOstergaard,[点击此链接](http://i.imgur.com/dHJ69Qx.png?1?4032)。以及'CardContext'位于哪个项目中? – 2014-09-04 11:01:30