I am developing an API in the .net core and using the Framework entity.
My bank already existed and in one of the tables I have a Point type field to store coordinates (Spatials).
I'm not using any automatic approach (Ex: code First, DataBase First ...), I am modeling my classes myself.
To map this Point field I did it as in primitive types, I believe to be wrong, and I'm getting an error:
System.InvalidOperationException: 'The property 'Address.LatLong' could not be mapped, because it is of type 'Point' 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'.'
public class Address:BaseModel
{
[Required]
[StringLength(30)]
public string Street { get; set; }
[Required]
public int Number { get; set; }
[StringLength(45)]
public string Observation { get; set; }
[Required]
[StringLength(20)]
public string PostalCode { get; set; }
[ForeignKey(nameof(City))]
[Required]
public int CityId { get; set; }
public virtual City City { get; set; }
public Point LatLong { get; set; } //this is the field
}