Reputation: 962
I am using fluent NHibernate. I want to create database by using mapping. My code is as
Shared Function GetConfig() As FluentConfiguration
Return Fluently.Configure().Database(MySQLConfiguration.Standard.ConnectionString(Function(c) c.Server("localhost").Database("im").Username("root").Password("pass"))).Mappings(Function(m) m.FluentMappings.AddFromAssemblyOf(Of UserMap())())
End Function
GetConfig().ExposeConfiguration(Function(c) New SchemaExport(c).Execute(script, export__1, justDrop)).BuildConfiguration()
but New SchmaExport(c) can't be compile. Error expression does not produce a value. What to I do to solve this. And will this function create database for me. or I am doing it wrong? Thanks
Upvotes: 0
Views: 216
Reputation: 160
Try this
GetConfig().ExposeConfiguration(Sub(x As NHibernate.Cfg.Configuration) Dim ex As SchemaExport = New SchemaExport(x)
ex.Execute(script, export__1, justDrop) End Sub).BuildConfiguration()
Upvotes: 1
Reputation: 204
return Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(_connectionString))
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
.BuildSessionFactory();
Upvotes: 1