小编use*_*706的帖子

使用NHibernate.AspNet.Identity

我试图使用Asp.net身份和NHibernate.

我使用.NET framework 4.5.1创建了一个新的空白Asp.net MVC站点,我已经安装并遵循了使用nuget包NHibernate.AspNet.Identity的说明,如下所述:

https://github.com/milesibastos/NHibernate.AspNet.Identity

其中涉及对AccountController类的默认构造函数进行以下更改:

var mapper = new ModelMapper();
mapper.AddMapping<IdentityUserMap>();
mapper.AddMapping<IdentityRoleMap>();
mapper.AddMapping<IdentityUserClaimMap>();
mapper.AddMapping<IdentityUserLoginMap>();

var mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();
var configuration = new Configuration();
configuration.Configure(System.Web.HttpContext.Current.Server.MapPath(@"~\Models\hibernate.cfg.xml"));
configuration.AddDeserializedMapping(mapping, null);

var schema = new SchemaExport(configuration);
schema.Create(true, true);

var factory = configuration.BuildSessionFactory();
var session = factory.OpenSession();

UserManager = new UserManager<ApplicationUser>(
                new UserStore<ApplicationUser>(session));
Run Code Online (Sandbox Code Playgroud)

我收到以下异常:

没有持久性:IdentityTest.Models.ApplicationUser

ApplicationUser类没有IdentityUser的任何其他属性(适用于Asp.net Identity的Entity Framework实现).

任何人都可以提供关于如何让Asp.net身份与这个NuGet包一起使用的建议吗?

nhibernate asp.net-mvc asp.net-identity

11
推荐指数
2
解决办法
6657
查看次数

标签 统计

asp.net-identity ×1

asp.net-mvc ×1

nhibernate ×1