Home

EFCore5, LinqPad6 - Get an error when creating a connection to DbContext with Geometry data type

Steps to replicate:

Create a EFCore 5 DbContext with a Geometry type from: NetTopologySuite (https://github.com/NetTopologySuite/NetTopologySuite)
Open Linqpad6 --> Add Connection
Choose "Use a type data context from your own assembly"
Click Next
Enter connection details, then click Test.

I get the following error:

If I remove the Geometry data type from the Context, then click Test, It is successful.

Is there a solution to this?

Comments

  • Seems like I was missing the x => x.UseNetTopologySuite() in the configuration:

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer("connectionString", x => x.UseNetTopologySuite());
        }
    

    After this, connection works fine.

Sign In or Register to comment.