Question

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?

Was it helpful?

Solution

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>());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top