ash
ash

Reputation: 45

Fluent NH Sqlite

is there a way to specify the location of where the Sqlite database is created through Fluent NH configuration?

I have attached the code below that I am using, and I would have thought that ExportTo would have done what I was after, but it only exports the hbm files to the specified location.

string fullPath = string.Format("{0}\DatabaseFiles\", Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory));

config = Fluently.Configure().Database(SQLiteConfiguration.Standard.ConnectionString(connectionString)).ExposeConfiguration(c =>
{
c.SetProperty("current_session_context_class", "thread_static");
if (exportSchema) {
    SchemaExport schema = new SchemaExport(c);
    schema.Drop(false, false);
    schema.Create(false, true);
}

}).Mappings(m => m.AutoMappings.Add(automappings).ExportTo(fullPath));

Upvotes: 0

Views: 173

Answers (1)

mathieu
mathieu

Reputation: 31192

You specify the filename through the Data Source parameter of the connection string:

Data Source=C:\folder\file.db

http://sqlite.phxsoftware.com/forums/p/938/4017.aspx

Upvotes: 1

Related Questions