问题
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