jonwagner / Insight.Database

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

Sybase ASE #352

Closed kuzlovsky closed 6 years ago

kuzlovsky commented 6 years ago

Hello, we were using Insight.Database-5.2.10 which worked well with Sybase.AdoNet4.AseClient 1.0.0

When upgrading to 6.X we've noticed that the Sybase provider is missing, also found this comment on the ChangeLog:

Sybase ASE is no longer supported until they post nuget packages

We would like to understand if we need to find an alternative ORM.

Could you please inform us what prompted you to drop support for Sybase? Is the reason that there are no more Sybase.AdoNet4.AseClient releases? Is the AseClient buggy? What do you need from Sybase to continue to support their drivers?

I see some more info in #319 but still don't understand what the issue is with Sybase.AdoNet4.AseClient

Thank you

Regards, Joe

jonwagner commented 6 years ago

It became too difficult to support all of the providers that required a manual driver install, so in 6.0, we switched to only supporting drivers that were available via NuGet.

Sybase hasn't posted an official package yet on NuGet yet. However, it looks like somebody has packaged up the driver, so I could bring back Sybase support if that driver works.

https://www.nuget.org/packages/Sybase.AdoNet4.AseClient/

I don't have a Sybase server up at the moment. Can you test this package to see if it works? If so, I'll roll out an updated client.

kuzlovsky commented 6 years ago

Hello,

The Sybase.AdoNet4.AseClient package does work. It lists Authors as SAP, so I assume it's the official package.

SybaseAseInsightDbProvider from Insight.Database-5.2.10 also works, except passing in parameters to stored procedures is broken. The driver expects the parameters with the @ symbol. We have managed to track it down and made it to work with:

1) commenting out the following code: // remove the @ from any parameters foreach (var p in command.Parameters.OfType()) p.ParameterName = _parameterPrefixRegex.Replace(p.ParameterName, String.Empty);

2) Specifying the customized mapping by code:

class StoredProcParameters
{
    [Column("@date")]
    public DateTime Date { get; set; }
}

conn.Query("StoredProcName", new StoredProcParameters
                {
                    @Date = new DateTime(2018, 2, 12)
                }

The anonymous types don't work because of the @ requirement:

conn.Query("StoredProcName", new 
                {
                    @Date = new DateTime(2018, 2, 12)
                }

Thanks

Regards, Joe

jonwagner commented 6 years ago

It sounds like it should work then. I'll make an attempt at it in the next dot release in the next week or two.

jonwagner commented 6 years ago

You're in luck. I was able to make Sybase work again with the package on nuget.

Caveats:

This code is in the 6.2 branch. I don't have a release date yet, but the code is there to get you started.