The Provider could not be resolved. You must explicitly set the Provider. MySql/ Devart
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
Hello @AdrienCss ,
Thank you for reporting; we will look into it.
Best Regards,
Jon
Hello @AdrienCss,
Support for Devart.Data.MySql.EFCore has been completed (only a few lines needed to be changed since it was already supported for EF6). A new version will be released next Tuesday.
Best regards,
Jon
Thanks Jonathan. Can't wait to use it!
Hello @AdrienCss,
Version v9.103.8 has just been released.
Let me know if everything is now working correctly with this provider.
Best regards,
Jon
Hello @JonathanMagnan,
Thanks again for the quick support!
Update on my side: → I confirm that with version v9.103.8:
ctx.DailyPriceDatas.RemoveRange(entities);
ctx.BulkSaveChanges();
→ Works perfectly! No more error on BulkDelete.
However, I'm facing new issues when inserting data:
- When using:
ctx.DailyPriceDatas.AddRange(entities);
ctx.BulkSaveChanges();
I get the following error: System.NotSupportedException: 'MySqlType 253 is not supported.'
- And when trying directly with:
ctx.BulkInsert(entities);
No error , but all inserted rows have only the auto-generated keys populated (database side PK(ID) ). All other columns are inserted with NULL values.
full code
using (var ctx = new Databasectx())
{
var entities = ctx.DailyPriceDatas.ToList();
// 1. Test BulkDelete → OK
ctx.DailyPriceDatas.RemoveRange(entities);
ctx.BulkSaveChanges(); // Works perfectly!
// 2. Test BulkInsert with AddRange + BulkSaveChanges → KO
ctx.DailyPriceDatas.AddRange(entities);
ctx.BulkSaveChanges(); // System.NotSupportedException: 'MySqlType 253 is not supported.'
// 3. Test BulkInsert directly → KO
ctx.BulkInsert(entities); ////No error but → rows are inserted with NULL values in database ( except autogenerated PK(ID))
}
Is there anything I should configure or adjust to make BulkInsert properly insert all column values?
Happy to help with tests or provide more details if needed.
Thanks a lot for your help!
Best regards, Adrien
Hello @AdrienCss ,
Thank you for reporting, I will have my developer look at it.
Best Regards,
Jon