使用MySQL流畅的NHibernate配置

时间:2012-09-23 19:54:41

标签: c# fluent-nhibernate

嗨伙计们我正在使用Fluent NHibernate和MySQL但我无法真正访问数据库我在配置中遇到错误

private static ISessionFactory CreateSessionFactory()
{
    var mysqlconf = MySQLConfiguration.Standard
        .ConnectionString(c => c.Is("Server=localhost;Database=db;User=root;Password=boot;"));

    return Fluently.Configure().Database(mysqlconf).Mappings(m =>
                                                             m.FluentMappings.AddFromAssemblyOf<Program>()).
        BuildSessionFactory();
}

请帮我配置我的代码以连接到我的数据库

错误 An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

1 个答案:

答案 0 :(得分:0)

我使用mysql.Net连接器6.6.2

修复了Visual Studio 2012的连接问题

这是下载链接 http://cdn.mysql.com/Downloads/Connector-Net/mysql-connector-net-6.6.2.msi