C# Fluent NHibernate MySQL批处理

C# Fluent NHibernate MySQL批处理,c#,mysql,nhibernate,C#,Mysql,Nhibernate,我需要将批量调整应用于我的NHibernate会话。我正在使用MySQL 在发现NHibernate本机不支持MySQL批量调整后,我安装了以下软件包: 它包含MySQL的批处理程序 然后,我在搜索可以注入批处理程序的点,发现: 根据公认的答案,我找不到这样的DataBaseIntegration()方法 以前有人用过这个软件包吗?我用过这个软件包,它对我有用 下面是我使用的配置: var cfg = new NHibernate.Cfg.Configuration(); cfg.SetPr

我需要将批量调整应用于我的NHibernate会话。我正在使用MySQL

在发现NHibernate本机不支持MySQL批量调整后,我安装了以下软件包:

它包含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);

我用过这个软件包,它对我有用

下面是我使用的配置:

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);

如果使用代码语法映射,那么我在MySql中的批处理设置如下(NH3.3+):-

var configure=新配置().configure();
configure.DataBaseIntegration(x=>
{
x、 方言();
x、 ConnectionStringName=“db”;
x、 批量大小=50;
x、 配料器();
})
.Cache(x=>x.UseQueryCache=true)
.CurrentSessionContext();

如果使用代码语法映射,那么我在MySql中的批处理设置如下(NH3.3+):-

var configure=新配置().configure();
configure.DataBaseIntegration(x=>
{
x、 方言();
x、 ConnectionStringName=“db”;
x、 批量大小=50;
x、 配料器();
})
.Cache(x=>x.UseQueryCache=true)
.CurrentSessionContext();

如果使用FluentNhibernate,我的映射代码可能会帮助您:

Dim fConfig As FluentConfiguration
...
fConfig.ExposeConfiguration(Function(x) x.DataBaseIntegration(Sub(y)
         y.Batcher(Of MySQLBatcher.MySqlClientBatchingBatcherFactory)()
         y.BatchSize = 100
     End Sub)

如果使用FluentNhibernate,我的映射代码可能会帮助您:

Dim fConfig As FluentConfiguration
...
fConfig.ExposeConfiguration(Function(x) x.DataBaseIntegration(Sub(y)
         y.Batcher(Of MySQLBatcher.MySqlClientBatchingBatcherFactory)()
         y.BatchSize = 100
     End Sub)

谢谢,我会在周一检查;)谢谢,我会在周一检查;)我认为4分支现在将嵌入mysql,可能现在不会对您有所帮助,但为将来指明方向总是很好的。是的,谢谢!Allready更新了我的项目:)我认为4个分支现在将嵌入mysql,可能现在不会帮助你,但为未来指出总是好的。是的,谢谢!Allready更新了我的项目:)