Fluent NHibernate ExportSchema without connexion string

Posted by Vince on Stack Overflow See other posts from Stack Overflow or by Vince
Published on 2010-05-06T09:15:55Z Indexed on 2010/05/06 9:18 UTC
Read the original article Hit count: 204

Hi all,

I want to propose to user a way to generate database table script creation. To do this for now i use NHibernate ExportSchema bases on a NHibernate configuration generated with Fluent NHibernate this way (during my ISessionFactory creation method):

FluentConfiguration configuration = Fluently.Configure();               
... Mapping conf ...
configuration.Database(fluentDatabaseProvider);
this.nhibernateConfiguration = configuration.BuildConfiguration();
returnSF = configuration.BuildSessionFactory();     

... Later
new SchemaExport(this.nhibernateConfiguration)              
                .SetOutputFile(filePath)
                .Execute(false, false, false);      

fluentDatabaseProvider is a FluentNHibernate IPersistenceConfigurer which is needed to get proper sql dialect for database creation.

When factory is created with an existing database, everything works fine. But what i want to do is to create an NHibernate Configuration object on a selected database engine without a real database behind the scene... And i don't manage to do this.

If anybody has some idea.

© Stack Overflow or respective owner

Related posts about fluent

Related posts about nhibernate