开发者

How to set encoding in fluent NHibernate?

I have created my database by this sql query: ("CREATE DATABASE " + DBName + " DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci", connection)

And I have this fluent configuration:

Fluently.Configure()
                     .Database(MySQLConfiguration.Standard.ConnectionString(c => c.Server(server)
                        .Database(DBName).Username(username).Password(password)))
                     .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>())
                     .Build开发者_如何学PythonSessionFactory();

How can I set NHibernate encoding in this configuration? or how can I set my mappings encoding?

I want to this because when I want to select with a property which has UTF8 encoding NHibernate sql will include ??????? in strings with encoding


var mysqlconf = MySQLConfiguration.Standard
.ConnectionString(c => c.Is("Server=srv;Database=db;User=dev;Password=pass;CharSet=utf8"));

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


Setting the database encoding is not related to Fluent NHibernate. Check your connection string, it should be like:

Server=myServerAddress;Database=myDataBase;Uid=user;Pwd=passw; CharSet=UTF8;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜