zzzprojects / Dapper-Plus

Dapper Plus - High-Efficient Bulk Actions (Insert, Update, Delete, and Merge) for .NET
https://dapper-plus.net/
383 stars 85 forks source link

Sql Server Spatial Support #59

Closed yahorsi closed 2 years ago

yahorsi commented 4 years ago

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

JonathanMagnan commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Hello @yahorsi ,

The latest version now better support spatial type.

However, the same question remain about the Point class.

yahorsi commented 4 years ago

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

JonathanMagnan commented 4 years ago

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 commented 4 years ago

Hello @yahorsi ,

The v3.0.4 has been released.

In this version, we added the support to:

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

yahorsi commented 4 years ago

will try it later and let you know if it works

karolswdev commented 2 years ago

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