Dapper-Plus icon indicating copy to clipboard operation
Dapper-Plus copied to clipboard

Sql Server Spatial Support

Open yahorsi opened this issue 4 years ago • 7 comments

Hi Guys!

What is the right way to BulkMerge entity that has Point member? E.g. here is the entity class definition:

    [Table("Airport")]
    public partial class Airport
    {

        [Key]
        [StringLength(4)]
        public string FourLetterCode { get; set; }
        
        [Required]
        [StringLength(3)]
        public string ThreeLetterCode { get; set; }
        
        [Required]
        [StringLength(50)]
        public string Name { get; set; }
        
        [StringLength(3)]
        public string CountryCode { get; set; }
        
        public bool IsDisabled { get; set; }
        
        [Column(TypeName = "datetime")]
        public DateTime Timestamp { get; set; }
        
        [Column(TypeName = "geometry")]
        public Point Location { get; set; }
        
        public string HotelCompany { get; set; }
        
        public string HotelContact { get; set; }
        
        public string HotelPhone { get; set; }
        
        public string HotelMobile { get; set; }
        
        public string HotelFax { get; set; }
        
        public string HotelEmail { get; set; }
        
        public string HotelRemarks { get; set; }
        
    }

Currently DapperPlus inserts null for the Point type member

Thanks

yahorsi avatar Jan 21 '20 09:01 yahorsi

Hello @yahorsi ,

We will check it. I don't think we currently support the Point class at this moment but we will try to add the support to it if that's possible.

Best Regards,

Jon

JonathanMagnan avatar Jan 21 '20 15:01 JonathanMagnan

Hello @yahorsi ,

Sorry for the long waiting, it looks that the request got stuck.

We added support to SqlGeometry and SqlGeography today (not release yet).

We wanted to make this request at the same time but we found out that the Point doesn't seem to be part of the Microsoft.SqlServer.Types dll.

Is it the System.Drawing.Point or a custom class of your?

JonathanMagnan avatar Feb 04 '20 18:02 JonathanMagnan

Hello @yahorsi ,

The latest version now better support spatial type.

However, the same question remain about the Point class.

JonathanMagnan avatar Feb 06 '20 19:02 JonathanMagnan

Hi Guys!

Sorry for the delayed answer. It is definitely from the Drawing :) It is NetTopologySuite.Geometries.Point But give me some time to figure out why we're using it ))

Thanks

yahorsi avatar Feb 07 '20 08:02 yahorsi

Hello @yahorsi ,

Just to let you know that the development of this request is going well.

In our branch, it's currently fully working with Microsoft.Data.SqlClient dll but partially work with System.Data.SqlClient dll on .NET Core as SqlBulkCopy doesn't support Udt Type on this platform.

We currently only need to fix a performance issue to release the support for Microsoft.Data.SqlClient. I believe it will probably be done tomorrow.

I will give you more information very soon.

JonathanMagnan avatar Feb 10 '20 01:02 JonathanMagnan

Hello @yahorsi ,

The v3.0.4 has been released.

In this version, we added the support to:

  • NetTopologySuite.Geometries.Point
  • NetTopologySuite.Geometries.Geometry

More type is coming soon. If there is some type you use than you would want us to prioritize, just let us know ;)

JonathanMagnan avatar Feb 12 '20 15:02 JonathanMagnan

will try it later and let you know if it works

yahorsi avatar Feb 12 '20 20:02 yahorsi

@JonathanMagnan - perhaps worth closing issues where you haven't heard back from users?

karolswdev avatar Sep 06 '22 19:09 karolswdev