jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM
Other
861 stars 145 forks source link

Complex data types #414

Closed AndreiNeagu27 closed 4 years ago

AndreiNeagu27 commented 4 years ago

Describe the feature

It would be great to have more complex dataTypes supported by this AMAZING ORM!

Is this feature related to a problem, describe

I was trying to use the SqlGeography dataType and Geography dataType in SqlServer, while trying to make an app the implements the Haversine formula. I kept getting the error Unable to cast object of type 'System.DBNull' to type 'System.Type'. and could not figure out, for the life of me, where was that comming from. So I cloned the repo, and looked at Insight.Database.Core.CodeGenerator.TypeConverterGenerator, that took me to the DbDataReaderWrapper ... unfortunaetly I could add the Microsoft.SqlServer.Type.dll so I could add the dataType myself.

Additional context

If you need any help in implementing this feature, I would be more than happy to help!

10x!

resnikb commented 4 years ago

@AndreiNeagu27 Hi Andrei, can you please share a minimal code sample that reproduces the issue?

andymac4182 commented 4 years ago

If there is actually a returned value does it work? Have you tried making the Property nullable?

jonwagner commented 4 years ago

There was limited support for the sql server custom types in .NET Core 1.0/2.0 when we ported the code. As of right now, Sql Server custom types are only supported in .NET Framework builds.

If that has changed in recent sql server builds then it should be pretty easy to reenable that functionality.

AndreiNeagu27 commented 4 years ago

Hi guys!

So it's a .NET Framework build. I just have a crazy period right now. By the end of next week I will have a working example of the error (huh, that sounds weird) as @resnikb requested.

Sorry for the late replies!

Jaxelr commented 4 years ago

This is the open issue on sqlclient that tracks this feature.

jonwagner commented 4 years ago

This is a duplicate of #418 - we will track the custom sql types in that issue.

Note that custom sql types work properly in net4x implementations.