问题
I've just upgraded my project from .NET Core 3.1 to .NET 5.0 and updating all packages to the latest version. All built fine, but now I'm having trouble loading some entities, getting this error:
Unable to cast object of type 'Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader' to type 'Microsoft.Data.SqlClient.SqlDataReader'.'
I'm not certain, but I have a couple of entities which have an Address property which is an[Owned]
type which has a NetTopologySuite.Geometries.Point
property, and I suspect perhaps this is the culprit.
I'm sorry that this question is so vague but I'm pretty stumped on what's wrong here, or how to diagnose it any further, if anyone has any ideas or pointers I'd be very grateful to hear them!
Edit: It's definitely an issue with NetTopologySuite. Barebones project here demonstrating the error
来源:https://stackoverflow.com/questions/64779031/invalidcastexception-after-upgrading-to-ef-core-5-0