I am using fluent nhibernate to create 3 databases at run time using 3 sessions.
ISessionFactory sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration
.MsSql2008
.ConnectionString(c => c
.Server(databaseServer)
.Database(dataBaseName)
.Username("sa").Password("sa123_MTTS")))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<NHibernateSessionFactory>())
.ExposeConfiguration(c => c.SetProperty("command_timeout", (System.TimeSpan.FromMinutes(10).TotalSeconds).ToString()))
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
private static void BuildSchema(Configuration config)
{
new SchemaUpdate(config).Execute(false, true);
}
Ex:
Here I am creating the database with names like "123", "234","345".
then I delete the database 123.
after deleting I closed the session also
sessionfactory.Close();
now again i add a database with the same name as the deleted database, "123".
SchemaUpdate(config).Execute()
is called. Nhibernate creates the database, but the tables are not created in the database, and I did not get any exceptions.
I don't know what's wrong with this.