如何配置自定义MySQL NHibernate Batcher? [英] How to configure custom MySQL NHibernate Batcher?
问题描述
带有MySQL Dialect的NHibernate不支持现成的批处理.我在nuget上找到了用于NHibernate的自定义MySQL Batcher.此外,以下是github链接:
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
但是我不知道如何将其注入/设置到我的hibernate.cfg.xml
配置中.
But I do not know how to inject/set this into my hibernate.cfg.xml
configuration.
如何配置自定义MySQL NHibernate Batcher?
How to configure custom MySQL NHibernate Batcher?
推荐答案
您需要设置的属性称为"adonet.factory_class".使用以下任何一项:
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>
或
configuration.SetProperty(
Environment.BatchStrategy,
typeof(MySqlClientBatchingBatcherFactory).AssemblyQualifiedName);
或如批处理程序本身的自述文件中所述(https://github.com/Andorbal/NHibernate.MySQLBatcher):
or as noted in the readme of the batcher itself (https://github.com/Andorbal/NHibernate.MySQLBatcher):
config.DataBaseIntegration(db =>
db.Batcher<MySqlClientBatchingBatcherFactory>());
这篇关于如何配置自定义MySQL NHibernate Batcher?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!