Make Fluent NHibernate output schema update to file
Posted
by Bender
on Stack Overflow
See other posts from Stack Overflow
or by Bender
Published on 2010-03-20T14:41:05Z
Indexed on
2010/03/20
14:51 UTC
Read the original article
Hit count: 334
fluent-nhibernate
|nhibernate
I am successfully getting Fluent NHibernate to update my database by calling UpdateBaseFiles:
Public Sub UpdateBaseFiles()
Dim db As SQLiteConfiguration
db = SQLiteConfiguration.Standard.UsingFile(BASE_DBNAME)
Fluently.Configure() _
.Database(db) _
.Mappings(Function(m) m.FluentMappings.AddFromAssemblyOf(Of FluentMap)()) _
.ExposeConfiguration(AddressOf UpdateSchema) _
.BuildConfiguration()
End Sub
Private Sub UpdateSchema(ByVal Config As Configuration)
Dim SchemaUpdater As New SchemaUpdate(Config)
SchemaUpdater.Execute(True, True)
End Sub
How do I output the DDL to a file, I do this when initially creating the schema by using:
Private Sub BuildSchema(ByVal Config As Configuration)
Dim SchemaExporter As New SchemaExport(Config)
SchemaExporter.SetOutputFile("schema.sql")
SchemaExporter.Create(False, True)
End Sub
but SchemaUpdate does not have a SetOutputFile method.
© Stack Overflow or respective owner