Reputation: 17627
Is there anything wrong with this code. I am not getting anything generated and no exceptions are thrown.
public static void ExportSchema()
{
Configuration cfg = LoadDefaultConfiguration();
Fluently.Configure(cfg)
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.Load("dnnSphere.Meta")))
.ExposeConfiguration(c => new SchemaExport(c).SetOutputFile("myDDL.sql").Execute(true,true,false));
}
Upvotes: 1
Views: 3823
Reputation: 6278
It depends on what you want to do. If you for instance is using a SQLite in memory db I never got it to work unless I specify the connection. This means I have to open a session and get the connection of the session first.
protected InMemoryFixture()
{
Configuration config = GetConfig();
ISessionFactory sessionFactory = config.BuildSessionFactory();
ISession session = _sessionFactory.OpenSession();
new SchemaExport(_config).Execute(true, true, false, session.Connection, Console.Out);
}
private Configuration GetConfig()
{
return GetMappings()
.Database(SQLiteConfiguration.Standard.InMemory)
.BuildConfiguration();
}
private FluentConfiguration GetMappings()
{
return Fluently.Configure().Mappings(m => m.FluentMappings.AddFromAssemblyOf<NewsMap>());
}
Then there is also SchemaExport(cfg).Create(true, true); and SchemaUpdate(cfg) of course.
Upvotes: 6