ThatRendle / Simple.Data

A light-weight, dynamic data access component for C# 4.0
MIT License
1.33k stars 302 forks source link

Add Support for User Defined Types In SQL Server #241

Open ghost opened 12 years ago

ghost commented 12 years ago

User Defined Type support for SQL Server would be a great addition to Simple.Data. It would make Simple.Data much easier for those people who work with the Spatial components in SQL Server. Currently the way to pass SqlGeometry and SqlGeography types to SQL Server are to first convert to WKT or WKB. See the post below on StackOverflow for discussion of workaround.

http://stackoverflow.com/questions/13035158/passing-sqlgeometry-to-simple-data-stored-procedure

seburgi commented 11 years ago

In some of my projects I use strongly typed Ids to make my Dtos more explicit. Those Ids are mostly wrappers around a simple type (like long) with implicit conversion operators. Would be great if I could use those directly for data access with Simple.Data.

public class PersonId
{
    public PersonId(long id)
    {
        Id = id;
    }

    public PersonId() {}
    public long Id { get; protected set; }

    public static implicit operator long(PersonId id)
    {
        return id.Id;
    }

    public static implicit operator PersonId(long id)
    {
        return new PersonId(id);
    }
}
ThatRendle commented 11 years ago

@seburgi Do you want to create a separate issue for that? It's a good feature request, but not really the same as SQL Server UDTs.

seburgi commented 11 years ago

@markrendle You are right, I created a new issue #310