Type 'Point' which is not supported by current database provider
See original GitHub issueI got the following error when I generated the code first migration.
The property 'Scheme.Polygon' is of type 'Point' which is not supported by current database provider. Either change the property CLR type or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
-----------There are what I did------------
- Startup.cs
services.AddDbContext<AppDbContext>(options =>
options.UseNpgsql(connectionString, o => o.UseNetTopologySuite()));
- Entity model:
using NetTopologySuite.Geometries;
public class Scheme
{
public Point Polygon { get; set; }
}
- DbContext:
protected override void OnModelCreating(ModelBuilder builder)
{
builder.HasPostgresExtension("postgis");
base.OnModelCreating(builder);
builder.Entity<Scheme>(options =>
{
options.Property(m => m.Polygon).HasColumnType("geography");
});
}
- I am using .net core 2.1, entity framework core & postgresql 10. Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
The property X is of type Y which is not supported by ...
I get the error: InvalidOperationException: The property 'Branch.Address' is of type 'Address' which is not supported by current database ...
Read more >Entity Framework Core: System.InvalidOperationException ...
InvalidOperationException: The property X is of type Y which is not supported by current database provider. Either change the property CLR ...
Read more >How to use EF Core when two properties in the Principle ...
I have 2 Model classes: Department.cs cs public class Department { public string DepartmentId { get; set; } public string Name { get;...
Read more >EF Core Mapping Help : r/dotnet
The property 'OrderItem.OrderProject' is of type 'Project' which is not supported by current database provider. Either change the property CLR ...
Read more >What's New in EF Core 7.0
EF7 contains provider-agnostic support for JSON columns, with an implementation for SQL Server. This support allows the mapping of aggregates ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, I was missing the mapping part:
b.Property(m => m.Coordinates).HasColumnType("geography");
I had the same problem, doing the following in my EntityConfiguration worked for me: