question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type 'Point' which is not supported by current database provider

See original GitHub issue

I 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------------

  1. Startup.cs
services.AddDbContext<AppDbContext>(options => 
   options.UseNpgsql(connectionString, o => o.UseNetTopologySuite()));
  1. Entity model:
using NetTopologySuite.Geometries;
public class Scheme
{
    public Point Polygon { get; set; }
}
  1. DbContext:
 protected override void OnModelCreating(ModelBuilder builder)
 {
         builder.HasPostgresExtension("postgis");
         base.OnModelCreating(builder);

         builder.Entity<Scheme>(options =>
         {
             options.Property(m => m.Polygon).HasColumnType("geography");
         });
 }
  1. I am using .net core 2.1, entity framework core & postgresql 10. Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
iamkineticcommented, Aug 10, 2018

Ok, I was missing the mapping part: b.Property(m => m.Coordinates).HasColumnType("geography");

0reactions
dtkturpalcommented, Mar 11, 2021

I had the same problem, doing the following in my EntityConfiguration worked for me:

.HasColumnType("geography (polygon)");
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found