Search code examples
c#nhibernateasp.net-identity

Nhibernate.AspNet.Identity Create the necessary tables


I am trying to use this gigantic bloated monster of a library, Identity, but I don't want to use entity framework. So I got NHibernate.AspNet.Identity!

I think I'm almost athe point of getting it to work but I can't seem to figure out how to generate the schema for the DB.

I thought it would automatically populate the DB with tables on first run. I was wrong...

Does anyone know where I can generate/find the schema for the database? Thanks!


Solution

  • Have you tried to use SchemaExport or SchemaUpdate (supports migration) classes from NHibernate.Tool.hbm2ddl? You may find usage example at What is schemaExport in Fluent NHibernate? and Fluent NHibernate - Create database schema only if not existing

    In a nutshell the code for FluentNHibernate looks something like (and is similar for XML-based configuartion)

    Fluently.Configure()
      .Database(/* configure database */)
      .Mappings(/* mappings */)
      .ExposeConfiguration(cfg => { new SchemaExport(cfg).Create(false, true); });