I have a database-first .net core 3.1 web application which connects to SQL Server database table with a geography
column. The database scaffolding and application build completes without any issue however when I run the application I get an error. If I add the [NotMapped]
attribute the error is gone but obviously the property is not mapped. What could be the issue?
The property 'Geometry.UserData' could not be mapped, because it is of type 'object' which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'."
I have installed these packages
- Microsoft.EntityFrameworkCore.SqlServer v3.1.8
- NetTopologySuite.Core v1.15.3
The scaffolded class look like this
public class MyClass
{
public int Id { get; set; }
public string Name { get; set; }
public NetTopologySuite.Geometries.Geometry Location { get; set; }
}
Object<T>
to database, maybe instead shouldn't you use a foreign key with theObject<T>
as its own table? – Primiparageography
– Sniggle