-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to Microsoft.Data.SqlClient
#374
Comments
@daniellittledev thanks for creating this issue. There is a comment regarding this: #337 (comment) My current idea is that until the new client library provides for feature that would make it useful to consumers of the TP which can't be achieved with existing client, the disruption for existing consumers is going to be problematic. I don't have experience switching codebase to new client library, and looking for feedback on this. @daniellittledev have you started using |
@smoothdeveloper my initial interest for this change is that It may be worth taking the same approach as |
@daniellittledev do you know if this can achieved while keeping the same codebase and using compiler defines rather than forking the library implementation? |
@smoothdeveloper I would assume so, but you would probably need two separate proj files as the dependencies would differ. They could both reference the same code and sit side by side. I'm unsure if there is an better/easier way to do it. |
@daniellittledev you can have conditionals in the same fsproj as well for the reference. |
@smoothdeveloper ah great, of course! |
@smoothdeveloper I don't know much about how to implement type providers or how much time I have at the moment but I'm open to helping out if I can. |
@daniellittledev I'd be happy to help with this investigation effort but can't commit time authoring it right now. I can help you get acquainted with the specificities related to TP, but those won't have significant interference with giving a try at changing the reference / changing the code. If you are willing to take on this experiment, I'll be able to review, and help meet the gap to eventually allow shipping two versions based on a branch with a full port. If you are looking to use the library with new client, I think you/someone giving it a try is a singificant enabling step. |
@smoothdeveloper ok, point me to anything you think would be helpful, I'll see what I can do. |
@daniellittledev you'll first need to add the references, in paket.dependencies DesignTime group and paket.references next to https://github.com/fsprojects/FSharp.Data.SqlClient/tree/master/src/SqlClient.DesignTime also add the normal nuget package reference in https://github.com/fsprojects/FSharp.Data.SqlClient/blob/master/src/SqlClient/SqlClient.fsproj after this, you can try replacing all the namespaces to point to new types, and get the solution to build, then the test projects green. If this can be reached, we will ponder on how to keep dual target for the time being. If you make a fork, you can open an experimental PR here to allow others to peek into the work. |
UTF-8 support and the fact that there is a problem with System.Data.SqlClient (#373) are good enough reasons IMO. |
I've been looking a bit more at this, so a bit of an update There are at least two dependencies that fail in a netstandard type provider: System.Configuration.ConfigurationManager This package is a Reference Assembly in netstandard and is only supported in net4x. Therefore it can not be used in a netstandard version. Microsoft.SqlServer.Types This package also only supports the net4x but it also has a dependency on System.Data.SqlClient which means no support in netstandard. The geospatial types it contains are also superseded by the NetTopologySuite package which EF Core now uses for dotnetcore support. I'm still trying to get a working version, but I'll comment again when I do. |
@daniellittledev thanks a lot for the update. So the two mentionned dependencies and features related to it may be put under conditional compilation. I'm also thinking integrating the work for supporting 'Microsoft.Data.SqlClient' will be supported by an extra assembly / nuget package. We will figure a way to support both from same codebase / solution, I think it is the best as it doesn't interfere with current consumers relying on the library and want to time their switch. Going another way would likely deter usage of this library due to lots of incurred changes/disruption if we planned to just replace. |
@smoothdeveloper I agree minimising disruption is a good approach. Although I've decided to get it working first then see how we can merge the two. I've also discovered p.s. There's no such thing as a |
I think it is only netframework and netstandard that will be the targets. |
After searching around for way too long I haven't found any hope or lead for loading the non-reference assembly in netstandard. However, it looks like type providers support But I haven't had much luck getting that to work either. The first problem is failing to load the DesignTime assembly from
If I manually copy the assembly into
I'm also trying to figure out how the Type Provider is loaded, or more specifically how can you verify which framework the tooling is running in. And how do type providers know which assemblies/package versions to load? There doesn't appear to be any other assemblies in the |
FWIW there is an issue tracking the lack of netstandard support for Microsoft.SqlServer.Types, but it's filed under "Ideas for Future" so I don't think there will be movement on it in the short term: dotnet/SqlClient#30. Another possibility might be https://github.com/dotMorten/Microsoft.SqlServer.Types, but that library does not fully implement spatial operations for SqlGeography or SqlGeometry so I'm not sure it's a viable option. |
@daniellittledev As I understand it this is determined by the compiler - if you want to make use of features available in the netfx version of the DTC, you will have to compile with MsBuild rather than |
@samhanes I mentioned NetTopologySuite which EF uses for spatial types #374 (comment) |
@smoothdeveloper IMO this project needs to make the leap to full net5.0/netstandard2.0 compatibility. People on legacy framework can still use older versions. Switching to Microsoft.Data.SqlClient is a "must have" for us as we frequently use other Sql libraries, which have all switched. I can't recall exactly what the issues are but trying to work with both Data.SqlClient libraries at the same time is not good. We have been using this project for over 7 years. Unfortunately we are forced to migrate all our projects to Dapper. |
I might try and pick this back up again, I was never able to get past the runtime errors after getting it to compile against |
I'm trying to find information on if Type Providers, particularly the DesignTime project, can target netcoreapp instead of netstandard. Because the some assemblies load the reference assembly instead of the implementation assembly at runtime. Does anyone know what FSharp Type Provider versions support which TargetFrameworks? |
@cartermp can you help with @daniellittledev 's last question? |
I've written up more about what I've tried and the issue I'm having with loading reference assemblies here #375 (comment) |
Maybe 2022 is the year we can switch to It seems that some of the libraries that previously caused trouble have been updated:
|
The way I am currently seeing it is we would compile / ship two versions of the type provider, likely compiled out of the same codebase, with different It remains to see if the current code, even without this @jackfoxy, @cr3wdayt5p, @charlesroddie, I am by no mean avoiding making this project take the leap to "spanking new" dotnet: I will carefully review and merge submitted PR that inch in that direction.
As far as I am concerned, the project needs to keep working on legacy framework, even in the future; I think this is true for a significant share of consumers of this library, this is not what is blocking anything, AFAIU. I am interested to know if people are actually using Microsoft.Data.SqlClient and what it does that System.Data.SqlClient doesn't. |
I am specifically interested in 'Microsoft.Data.SqlClient' as it supports Azure's Managed Identity feature directly in the connection string. Hence it would be possible to use Managed Identity (secretless apps) with 'FSharp.Data.SqlClient' without any other code changes. It even has the potential to eliminate the need for different connection strings for design and compile time. Example connection string – not supported by 'System.Data.SqlClient':
|
netstandard2.0 deals with this issue. It supports legacy frameworks going back to 4.6.1, which was released 7 years ago and is EOL. There is something really silly about jumping through hoops to have |
@cr3wdayt5p interesting, thanks for the feedback, I see this as interesting factual motivator, are you interested to try out to "convert" this repository, in a prototype branch? @charlesroddie, please refrain from characterizing things in negative fashion (about things being "really silly"), just out of your own bitterness and maybe oversight about underlying reasons, which you don't seem to put attention in a generous fashion here, hence likely to be ignored (unlike PR that don't break anything and make the project advance). I don't see a reason not to drop .net 4.0 and target net 4.8 instead (if nobody opposes to make this the lowest framework for new releases), given VS 2022 doesn't support .net 4.0 anymore but:
I think this has not much to do with this issue, so @charlesroddie, if you want to help with "really silly" things, you may open an issue, or make narrowly targetted PR, that changes .NET 4.0 to .NET 4.8 as the lowest supported framework. Back to the issue: The library in this repository cannot drop the support for System.Data.SqlClient, but we can definitely sketch things to support both System.Data.SqlClient and Microsoft.Data.SqlClient, the first step is to have a prototype supporting the later, and having some design discussions around supporting both. I hope this helps. If there is enough interest, as people seems to put it in comments here, and people put efforts into it, I'm sure we'll see a prototype for supporting Microsoft.Data.SqlClient emerge. |
@smoothdeveloper I am still pretty new to F# and .NET in general. So I am probably not the right person to take on such a project. But I will be happy to give feedback and help test the changes. Suggestion: How about making a clean break as a new major version, i.e. let v3.0.0 be .NET 6 and switch to Microsoft.Data.SqlClient only? This way all existing projects could continue to use the v2-branch (supporting older .NET versions and using System.Data.SqlClient). Wouldn't it be simplere to support two "clean" versions rather than one convoluted project? It would also make it easier for developers new to F#/.NET (like myself) to contribute to the project, e.g. I only have experience with .NET 6.0 so I don't know what is needed to support the older versions (and I don't have any motivation to learn that as all my own projects will be .NET 6.0 or higher). |
@cr3wdayt5p I'm not clear what I'm looking for would make the project significantly more convoluted, as we are talking about a type provider. To me, maintaining two branches for bug fixes and features is a sure way to spend more time doing so and have both forks bifurcate than if it can consolidate on same code base (which I assume is doable, and maybe just a mater of adding overloads and managing a bit of state, not even needing This can only be assessed out of a prototype and such prototype, if it would drop System.Data.SqlClient would achieve what you are after. Also I am not asking contributors / maintainers to care specifically for .net framework, if a contribution has glitches with it, I'm willing to pay a look and do what is doable to address it. |
I think it's time to drop support for NET4.x, we're jeopardising the future of this project for a legacy framework. @cartermp 's comments on this subject are pretty clear, it's not worth supporting in future versions source:
I'm caught by this issue once again, and if I can't get this working on dotnetcore 6.0 I don't think I'll be able to use this project going forward. I might have time for a final attempt at spiking |
@smoothdeveloper earlier in the thread said it was OK to drop net framework < 4.8. Which means that going to netstandard2.0-only would be fine as netstandard2.0 supports framework 4.8 and even a few earlier versions. Can you clarify your position @smoothdeveloper so that @daniellittledev doesn't waste time? |
Some notes on my recent spike: While Host tools include:
See source F# Tooling RFC FST-1003 - Loading Type Provider Design-Time Components into F# Tooling Then there are The first issue I ran into is that the The package Currently I'm trying to figure out how to load the dll for this package, which doesn't work because it's a native assembly and it does not trigger To test it I'm building
I wonder if I could avoid these issues by using a merged TP without a separate TPDTC. Maybe @dsyme or @cartermp can provide some insight here? Edits: Native Assemblies
Although there are four runtimes Visual Studio Error I also incorrectly had the design time dll in the
After some more digging I think VS doesn't support More Notes
|
I am currently blocked due to being unable to load a native dll for Microsoft.Data.SqlClient.SNI.runtime on windows. See my full comment at dotnet/fsharp#3736 (comment) |
@daniellittledev Maybe it is possible to avoid loading the native SNI by switching to managed SNI on Windows?
Sources: |
@cr3wdayt5p thanks, that does look promising! |
Description
As
Microsoft.Data.SqlClient
is due to supersede/replaceSystem.Data.SqlClient
FSharp.Data.SqlClient should consider switching toMicrosoft.Data.SqlClient
.The text was updated successfully, but these errors were encountered: