-
Notifications
You must be signed in to change notification settings - Fork 58
Description
i'm encountering an issue with the Bulk methods from the Z.EntityFramework.Extensions.EFCore library in my .NET 9 application.
The exception message is: "The Provider could not be resolved. You must explicitly set the Provider."
Here are the details of my setup:
• .NET Version: .NET 9
• Z.EntityFramework.Extensions.EFCore Version: 9.103.7.2
• Database: MariaDB
• Connector: Devart.MySql connector used to generate the schema
Dependencies :
- devart.data.mysql.efcore\9.4.193.9
- microsoft.entityframeworkcore\9.0.3
- devart.data.mysql\9.4.193
- microsoft.entityframeworkcore.relational\9.0.3\
The relevant code snippet where the exception occurs is as follows:
using (var ctx = new Databasectx())
{
var entities = ctx.DailyPriceDatas.ToList();
ctx.DailyPriceDatas.RemoveRange(entities);
ctx.BulkSaveChanges(); // Exception occurs here
// ctx.SaveChanges() //This works
}
The exception stack trace is:
System.Exception: 'The Provider could not be resolved. You must explicitly set the Provider.'
at Z.BulkOperations.BulkOperation.()
at Z.BulkOperations.BulkOperation.Execute()
at Z.BulkOperations.BulkOperation.BulkDelete()
at .BulkDelete[T](DbContext this, IEntityType entityType, IEnumerable1 list, Action1 options, SavingSelector savingSelector, Boolean forceSpecificTypeMapping)
at .BulkDelete[T](DbContext this, IEnumerable1 entities, Action1 options, Boolean isBulkSaveChanges)
at .(DbContext this, List1 , Action1 )
at .(DbContext this, StateManager , IReadOnlyList1 , Action1 )
at .(DbContext this, StateManager , IReadOnlyList1 , Action1 )
at .(DbContext this, Action1 , DbContext ) at DbContextExtensions.BulkSaveChanges(DbContext this, Action1 options)
at DbContextExtensions.BulkSaveChanges(DbContext this)
Additionally, here is the configuration of my DbContext class:
public partial class Databasectx: DbContext
{
public Databasectx() :
base()
{
OnCreated();
}
public Databasectx(DbContextOptions<Databasectx> options) :
base(options)
{
OnCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured ||
(!optionsBuilder.Options.Extensions.OfType<RelationalOptionsExtension>().Any(ext => !string.IsNullOrEmpty(ext.ConnectionString) || ext.Connection != null) &&
!optionsBuilder.Options.Extensions.Any(ext => !(ext is RelationalOptionsExtension) && !(ext is CoreOptionsExtension))))
{
optionsBuilder.UseMySql(@"MyConnectionstring");
}
CustomizeConfiguration(ref optionsBuilder);
base.OnConfiguring(optionsBuilder);
}
}
Could you please provide guidance on how to resolve this issue? Any help would be greatly appreciated.
Thank