Search code examples
c#asp.netnhibernatefluent-nhibernateasp.net-identity

ASP.NET Identity Fluent NHibernate bind the mappings:


https://nhibernateidentity.codeplex.com/documentation In this docs is written:

First you need install the package:

 PM> Install-Package NHibernate.Identity

After you installed you need to bind the mappings:

.Mappings(m => m.FluentMappings.AddFromAssemblyOf<IdentityUser>())

How and where? Can someone try to explain. I want to use Nhiberant with Identity


Solution

  • The .Mappings(m => m.FluentMappings.AddFromAssemblyOf<IdentityUser>()) has to be added where you create your Config for the SessionFactory with FluentNHibernate. It should look like this

    var config = Fluently.Configure()
                .Mappings(mappingConfig => 
                          mappingConfig.FluentMappings.AddFromAssemblyOf<IdentityUser>());