Closed chefarbeiter closed 5 months ago
@chefarbeiter Thanks for reporting this bug! I've been able to reproduce the problem in Oracle EF Core 8 and the optimize option is working with EF Core 7. I opened bug 36179457. We'll have an Oracle dev team member review the problem.
Hello @alexkeh,
I see a new package release today but I continue to encounter this issue related to compiled model:
System.InvalidOperationException: The type mapping used is incompatible with a compiled model. The mapping type must have a 'public static readonly MySQLStringTypeMapping MySQLStringTypeMapping.Default' property.
Is the new release contains the fixes related to compiled models since .NET 8 ?
@ChristopheLav Yes. The 21.14 release contains the Oracle EF Core compiled models fix.
Your specific error occurs with MySQLStringTypeMapping
. This appears to be a MySQL provider property, not an ODP.NET one.
@alexkeh Ok - where is the right place to report this error ? The compiled models continue to not working correctly due to the lack of full .NET 8 changes implementation. I hope the next servicing release definitively fix the issue(s).
Thank you for your help.
@ChristopheLav If you are using the Pomelo MySQL EF Core provider, you can start try their GitHub page.
@alexkeh I'm not using Pomelo but the MySQL one 😉
If I do one research on the MySQL provider code I see the missing part: https://github.com/mysql/mysql-connector-net/blob/8.x/EFCore/src/Storage/Internal/MySQLStringTypeMapping.cs
System.InvalidOperationException: The type mapping used is incompatible with a compiled model. The mapping type must have a 'public static readonly MySQLStringTypeMapping MySQLStringTypeMapping.Default' property.
I think some changes like that is required to support correctly the Compiled Models with .NET 8 : https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/pull/1839/files
Since the mysql/mysql-connector-net repo has the issues disabled, I can't post here. Can you help with that please ?
@ChristopheLav I forwarded your issue to a MySQL dev manager and product manager for .NET to advise on how to move forward with resolving this error.
@alexkeh thank you so much 👍
I use compiled models to improve performance. This still worked with the Oracle Data Provider for EF7, but no longer from EF8 onwards, as the necessary adjustments were not made.
The problem can be reproduced with the following minimal example: Sample.csproj
Program.cs
If I now try to compile the model with the
dotnet-ef
tool (dotnet ef dbcontext optimize
), the following exception is thrown:If the EF7 versions Oracle.EntityFrameworkCore 7.21.13 and Microsoft.EntityFrameworkCore.Design 7.0.15 are used, the model can be compiled without any problems.