0

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

2 Answers 2

1

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()
Sign up to request clarification or add additional context in comments.

Comments

1
                return Fluently.Configure()
                .Database(MsSqlConfiguration.MsSql2008.ConnectionString(_connectionString))
                .Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
                .BuildSessionFactory();

2 Comments

i want to fuildconfiguration not sessionfactory. and for mysql. this works when sessionfactioy has to be created. Thanks
Youre Welcome Bro :).. Can you raise my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.