流利的NHibernate MySQL批处理 [英] Fluent NHibernate MySQL batching
问题描述
我需要对NHibernate会话应用批量调整大小.我正在使用MySQL.
发现后,NHibernate本身不支持MySQL的批量调整大小,因此我安装了此软件包:
http://www.nuget.org/packages/NHibernate.MySQLBatcher
其中包含MySQL的批处理程序.
然后我正在寻找可以注入配料器的位置并找到了这个点
为什么NHibernate不支持在MySql上进行批处理 >
根据接受的答案,我找不到这种DataBaseIntegration()
方法.
以前有人通过吗?
我已经使用了此软件包,并且对我有用.
在我使用的配置下面:
var cfg = new NHibernate.Cfg.Configuration();
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.MySqlDataDriver");
cfg.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MySQLDialect");
cfg.SetProperty(NHibernate.Cfg.Environment.UseSecondLevelCache, "false");
cfg.SetProperty(NHibernate.Cfg.Environment.UseQueryCache, "false");
cfg.SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, "false");
cfg.SetProperty(NHibernate.Cfg.Environment.CommandTimeout, "300");
cfg.SetProperty(NHibernate.Cfg.Environment.BatchSize, "1000");
cfg.SetProperty(NHibernate.Cfg.Environment.BatchStrategy, typeof(MySqlClientBatchingBatcherFactory).AssemblyQualifiedName);
I need to apply batch sizing to my NHibernate Sessions. I am using MySQL.
After finding out, that NHibernate doesn't natively support batch sizing for MySQL I installed this package:
http://www.nuget.org/packages/NHibernate.MySQLBatcher
which contains a batcher for MySQL.
Then I was searching for the point where I can inject the batcher and found this:
Why doesn't NHibernate support batching on MySql
According to the accepted answer I don't find something like this DataBaseIntegration()
method.
Has anyone got through this before?
I have used this package and it worked for me.
Below the configuration I used:
var cfg = new NHibernate.Cfg.Configuration();
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.MySqlDataDriver");
cfg.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MySQLDialect");
cfg.SetProperty(NHibernate.Cfg.Environment.UseSecondLevelCache, "false");
cfg.SetProperty(NHibernate.Cfg.Environment.UseQueryCache, "false");
cfg.SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, "false");
cfg.SetProperty(NHibernate.Cfg.Environment.CommandTimeout, "300");
cfg.SetProperty(NHibernate.Cfg.Environment.BatchSize, "1000");
cfg.SetProperty(NHibernate.Cfg.Environment.BatchStrategy, typeof(MySqlClientBatchingBatcherFactory).AssemblyQualifiedName);
这篇关于流利的NHibernate MySQL批处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!