Is it possible through FluentNHibernate to create the database just as tables are created? I have the following class:
public class Helper : IRepositorioHelper
{
private static ISessionFactory _sessionFactory;
private static ISessionFactory SessionFactory()
{
_sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2012
.ConnectionString(x => x
.Server(".\Servidor")
.Database("BaseDados")
.Username("sa")
.Password("****"))
.ShowSql())
.Mappings(x => x.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
.ExposeConfiguration(cfg => new SchemaUpdate(cfg).Execute(true, true))
.BuildSessionFactory();
return _sessionFactory;
}
public static ISession OpenSession()
{
return SessionFactory().OpenSession();
}
public void CriaDatabase()
{
SessionFactory();
}
}
With it I can create the tables without problems but I wanted to know if it is also possible to create the base to make it even easier when I distribute my application.