How to configure custom MySQL NHibernate Batcher?

别说谁变了你拦得住时间么 提交于 2019-12-24 03:38:11

问题


NHibernate with MySQL Dialect does not support Batching out of the box. I have found custom MySQL Batcher for NHibernate on nuget. Also, following is the github link:

https://github.com/Andorbal/NHibernate.MySQLBatcher

But I do not know how to inject/set this into my hibernate.cfg.xml configuration.

How to configure custom MySQL NHibernate Batcher?


回答1:


The property you need to set is call "adonet.factory_class". Use any of the following:

<property name="adonet.factory_class">assembly-qualified-name</property>

or

configuration.SetProperty(
    Environment.BatchStrategy,
    typeof(MySqlClientBatchingBatcherFactory).AssemblyQualifiedName);

or as noted in the readme of the batcher itself (https://github.com/Andorbal/NHibernate.MySQLBatcher):

config.DataBaseIntegration(db =>
    db.Batcher<MySqlClientBatchingBatcherFactory>());


来源:https://stackoverflow.com/questions/14210857/how-to-configure-custom-mysql-nhibernate-batcher

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!