Fix EF Core issue when using MySqlGeometry.Value#829
Fix EF Core issue when using MySqlGeometry.Value#829bgrainger merged 1 commit intomysql-net:masterfrom
Conversation
…byte>` will throw an exception in `Microsoft.EntityFrameworkCore.Storage.Internal.DbParameterCollectionExtensions.FormatParameterValue(StringBuilder builder, object parameterValue)`. Signed-off-by: Laurents Meyer <laucomm@gmail.com>
I don't think This change does make the And shouldn't you submit a PR to fix EFCore, adding |
Fixed in afa4bf5. |
|
Fixed in 0.69.0. |
Good point!
Thanks, that was quick!
I am thinking about it. Might be worth it for EF Core 5. |
EF Core throws an exception, when using
MySqlGeometry, because there is some very general code inMicrosoft.EntityFrameworkCore.Storage.Internal.DbParameterCollectionExtensions.FormatParameterValue(StringBuilder builder, object parameterValue), that is unable to handle theReadOnlySpan<byte>type ofMySqlGeometry.Value.This PR changes the type to
byte[]instead. Technically, this is a breaking change for anyone who used theValueproperty before. But because of the implicit cast betweenbyte[]andReadOnlySpan<byte>, this should be less of an issue.In any case, if there is an issue in someones code, this change will lead to a compiler error, that can be easily fixed by replacing
Valuewith eitherValue.AsSpan()ornew ReadOnlySpan<byte>(Value).