Object reference not set to an instance of an object for BatchDelete
Hi,
I am trying to use the basic BatchDelete functionality on EFCore for MySql
My code is as follows:
context.Users.Where(u => u.Email == null).Delete();
When running the statement I receive Object reference not set to an instance of an object for the type. See partial stack trace below:
System.NullReferenceException: Object reference not set to an instance of an object. at System.Object.GetType() at Z.EntityFramework.Plus.BatchDelete.Execute[T](IQueryable1 query)`
Please advise what am I doing wrong?
Many thanks,
Warren
Hello @wschay ,
Thank you for reporting.
Looking at the code, MySQL is currently only supported for EF5 and EF6 which explains why you get this error under EFCore.
We will try to fix this issue Wednesday.
Best Regards,
Jonathan
Hello @wschay ,
We are currently implementing the support for Batch Delete && Batch Update.
We tested both methods and they are currently working fine in our dev environment.
However, the solution depends on the third party library used for MySQL.
Could you provide us the library name you are using? By example:
- https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql
- https://www.nuget.org/packages/SapientGuardian.EntityFrameworkCore.MySql/
- Another one?
Best Regards,
Jonathan
Hi Jonathan,
I'm currently using the pre-release of the official mysql provider.
https://docs.microsoft.com/en-us/ef/core/providers/mysql/
Many thanks,
Warren
Sent from my Samsung Galaxy smartphone.
-------- Original message -------- From: Jonathan Magnan [email protected] Date: 2017/07/11 10:53 PM (GMT+02:00) To: zzzprojects/EntityFramework-Plus [email protected] Cc: Warren Schay [email protected], Mention [email protected] Subject: Re: [zzzprojects/EntityFramework-Plus] Object reference not set to an instance of an object for BatchDelete (#182)
Hello @wschayhttps://github.com/wschay ,
We are currently implementing the support for Batch Delete && Batch Update.
We tested both methods and they are currently working fine in our dev environment.
However, the solution depends on the third party library used for MySQL.
Could you provide us the library name you are using? By example:
- https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql
- https://www.nuget.org/packages/SapientGuardian.EntityFrameworkCore.MySql/
- Another one?
Best Regards,
Jonathan
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/zzzprojects/EntityFramework-Plus/issues/182#issuecomment-314568325, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AcrbbNplGg32_nu1cxKZ_y_Sxkqb6Kzlks5sM-DHgaJpZM4OT7JA.
Thank you,
We will update the code tomorrow to also support it and release the fix
Best Regards,
Jonathan
Hello @wschay ,
Are you aware how to fix this following error?
FileLoadException: Could not load file or assembly 'MySql.Data, Version=6.10.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
It looks I'm not alone having this issue. https://forums.mysql.com/read.php?38,650219,650868
If you don't know, that's fine. I will release a blind version and pray it will work ;)
Best Regards,
Jonathan
Hi Jonathan,
Unfortunately, I haven't come across that error before :(
Regards,
Warren
Sent from my Samsung Galaxy smartphone.
-------- Original message -------- From: Jonathan Magnan [email protected] Date: 2017/07/12 9:11 PM (GMT+02:00) To: zzzprojects/EntityFramework-Plus [email protected] Cc: Warren Schay [email protected], Mention [email protected] Subject: Re: [zzzprojects/EntityFramework-Plus] Object reference not set to an instance of an object for BatchDelete (#182)
Hello @wschayhttps://github.com/wschay ,
Are you aware how to fix this following error?
FileLoadException: Could not load file or assembly 'MySql.Data, Version=6.10.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
It looks I'm not alone having this issue. https://forums.mysql.com/read.php?38,650219,650868
If you don't know, that's fine. I will release a blind version and pray it will work ;)
Best Regards,
Jonathan
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/zzzprojects/EntityFramework-Plus/issues/182#issuecomment-314868226, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AcrbbBmdrZGfSHJTDKlnOxJDN16ZiWmJks5sNRphgaJpZM4OT7JA.
Hi @wschay
Just came across this error around BatchUpdate, with DotNet Core 2 preview 2:
Could not load type 'Microsoft.EntityFrameworkCore.Query.Internal.RelationalQueryContextFactory' from assembly 'Microsoft.EntityFrameworkCore.Relational, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Arborescence des appels de procédure :
at Z.EntityFramework.Plus.InternalExtensions.GetDbContext[T](IQueryable`1 source)
at Z.EntityFramework.Plus.BatchUpdate.Execute[T](IQueryable`1 query, Expression`1 updateFactory)
I still have the error with version 1.6.5.
Regards, Thibault
Bonjour @tvoisin ,
Could you try by adding assemblyBinding in your config file
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.EntityFrameworkCore" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-1.1.1.0" newVersion="2.0.0.0" />"
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.EntityFrameworkCore.Relational" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-1.1.1.0" newVersion="2.0.0.0" />"
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-1.1.1.0" newVersion="2.0.0.0" />"
</dependentAssembly>
</assemblyBinding>
</runtime>
I believe this issue is more related because our library is compiled with version 1.x but also work with 2.x ... We may need to release a version under 2.x probably in the future to avoid this kind of error.
Best Regards,
Jonathan
Hello @wschay ,
The v1.6.6 has been released.
Unfortunately, we only successfully tested it with Pomelo so perhaps that's still not fully working with the mysql provider you are using due to a typing mistake.
Please, let us know if that work or not and report us any error.
Best Regards,
Jonathan
Hi @wschay,
The binding redirect trick did not work, so I tried recompiling using Microsoft.EntityFrameworkCore.Relational 2.0.0-preview2-final (on framework standard 2.0). Some interfaces have been broken between the 2 versions, but I managed to have the whole thing working: I will make you a pull request with those changes.
Hello @tvoisin ,
The v1.6.11 has been released supporting EF Core 2.0 stable
Best Regards,
Jonathan
On the current version, I caught this error. What to do? MySql Pomelo 3.1
Hello @xeleoss ,
Could you provide a runnable project with this issue?
Best Regards,
Jon
Hello @xeleoss ,
Could you provide a runnable project with this issue?
Best Regards,
Jon
The project is no longer there. The error was on ubuntu 18.04. Before that, it was tested on windows 10 and worked.