Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure fluent nHibernate with MySQL

I'm trying to configure nHibernate to use a MySql database. I found examples for mssql and sqlite but none for mysql. So, how do I change this so it uses mysql:

Fluently.Configure().Database(
        MsSqlConfiguration.MsSql2005.ConnectionString(
            c => c.FromConnectionStringWithKey("ConnectionString")
        )
    )
    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyAutofacModule>())
    .BuildSessionFactory())
like image 692
Spikolynn Avatar asked Mar 09 '09 13:03

Spikolynn


1 Answers

Change MsSqlConfiguration.MsSql2005, to MySqlConfiguration.Standard, it was the one thing I contributed to the project.

Example:

Fluently.Configure().Database(
        MySqlConfiguration.Standard.ConnectionString(
            c => c.FromConnectionStringWithKey("ConnectionString")
        )
    )
    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyAutofacModule>())
    .BuildSessionFactory())
like image 180
Mark Rogers Avatar answered Oct 16 '22 13:10

Mark Rogers