yangzhongke / Zack.EFCore.Batch

Deleting or Updating multiple records from a LINQ Query in a SQL statement without loading entities
GNU General Public License v3.0
590 stars 85 forks source link

多版本数据库问题 #129

Closed HaoDaYiGuoFan closed 6 months ago

HaoDaYiGuoFan commented 6 months ago

大佬你好,我在项目中同时添加了sqlserver/Npgsql版本的Nuget包,在 OnConfiguring中根据appSetting中数据库类型动态操作 if (AppSettings.Instance.DBProvider == "Npgsql") { optionsBuilder.UseBatchEF_Npgsql(); } else { optionsBuilder.UseBatchEF_MSSQL(); }

但是实际上在代码中context.BulkInsert()时都只会跑到Zack.EFCore.Batch.Npgsql_NET6中去,所以想要使用不同数据库每次只能修改程序引用的nuget包(比如sqlserver时删除Npgsql版本的Nuget包引用)并重新发布,这种有什么办法解决嘛