Microsoft.AspNet.Identity.EntityFramework中的IdentityDbContext <tuser>隐藏基础DbContext构造函数</tuser>

时间:2013-10-20 14:16:05

标签: visual-studio-2013 entity-framework-6 asp.net-mvc-5 asp.net-identity

我正在使用Visual Studio 2013 RTM和asp.net mvc 5实体框架asp net identity provider 我正在做以下

    public class MyContext : IdentityDbContext<MyUser>
    {
        public MyContext (DbCompiledModel model):base(model)
        {


        }    

        public DbSet<Foo> Foos{ get; set; }
        public DbSet<Bar> Bars{ get; set; }   

    }

并在此行上收到编译时错误

public MyContext (DbCompiledModel model):base(model)

IdentityDbContext类隐藏了DbContext的所有构造函数。 有没有解决方法?

1 个答案:

答案 0 :(得分:1)

IdentityDbContext只有两个构造函数

  • IdentityDbContext()
  • IdentityDbContext(String connectionString)

在继承IdentityDbContext时,您需要遵循其可用的指导。因此,您不能使用DbCompiledModel来构造上下文。