- Notifications
You must be signed in to change notification settings - Fork68
Microsoft.Data.SqlClient#441
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…em.Data.SqlClient to 4.9.0, Added TrustServerCertificate to connectionstrings, added
Fixes for Samples.sln
# Conflicts:#paket.lock#src/SqlClient.Samples/WebApi.Controllers/App.config
…erver.Server.SqlDataRecord should probably be used via some other reference package.
# Conflicts:#RELEASE_NOTES.md#netfx.props#nuget/SqlClient.nuspec#paket.dependencies#paket.lock#src/SqlClient.DesignTime/AssemblyInfo.fs#src/SqlClient.Samples/WebApi.Controllers/App.config#src/SqlClient.Samples/WebApi/web.config#src/SqlClient.Samples/WpfDataBinding/App.config#src/SqlClient.TestProjects/Lib/Script.fsx#src/SqlClient/AssemblyInfo.fs#src/SqlClient/DataTable.fs
smoothdeveloper commentedMay 6, 2025
@Thorium thanks, this looks very encouraging, I didn't had chance to try it out yet. I tried to reach out to you on fsharp slack, in order to plan synchronous call if tractable on your end. As it is, right now, I'll only merge either of two things, that we can definitely collaborate to bring to fruition:
I'd favor the first one, which enables, over few releases, maybe 2 major releases, support, then obsoleted support, then removal of obsoleted support. Otherwise we are going to break the ecosystem of users who use the library, it is not trivial to conduct a 100 switch over in large codebases, that have lots of historical, non encapsulated calls, even aside of using this library. I want people doing .NET migration of this nonsense Microsoft has done, and using this library, to have a better experience switching over, and to me, supporting overloads makes the most sense, so the F# side of such migration is very easy, in comparison to .NET code that uses the raw ADO.NET APIs, which involve a lot of testing (talking about legacy applications with thousands of scattered ADO.NET API calls) for a switch over. I hope the concern and intent I express is clear, and we can soon decide best way forward. |
Thorium commentedMay 6, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
smoothdeveloper commentedMay 6, 2025
It is not because Microsoft is doing something stupid that I'll do the same. I'm fine with releasing a separate nuget package, with precompiler flags that keeps the same codebase. I don't care about Microsoft dictating obsoleting, I care about legacy codebases, that are valuable to businesses everywhere, and not coercing maintainers of those into doing big bang refactoring, if they prefer a gradual update. This is totally doable, we just need to collaborate and not get stuck with Microsoft dictating how big bang refactors get funded by their clients, on terms of Microsoft only. |
Thorium commentedMay 6, 2025
As far as I understand, FSharp.Data.SqlClient is an abstraction layer over the database driver, and both drivers (System.Data.SqlClient and Microsoft.Data.SqlClient) do support e.g. net462. So the user refactoring should be minimal (basically maybe catching some new Microsoft.Data.Exceptions if they now catch only System.Data.Exceptions). The scary "platform not supported" error is not about platform at all, it's about picking libs-reference when runtime-reference should be used. |
smoothdeveloper commentedMay 6, 2025
This is why supporting both overload, for million $$$ codebases that are very legacy (not specific to FSharp.Data.SqlClient, but vanilla ADO.NET), those codebase will always face challenge in terms of claiming "Microsoft is forcing us to switch, like a big bang, from one release to next, from 0 to 100% switch" (because Microsoft doesn't, it enables gradual upgrade). Instead, people need ability to change some of the calls, in some spots, and slowly build a momentum, that doesn't break product, or monopolize team for no value added to end users, beside adressing Microsoft diktat of deprecating package, but never be constrained to have one provider or other, exclusively, in the whole codebase. This is why, I suggest my first solution, to support overloads, this is technically achievable, 100% backward compatible, and letting all freedom for consumers, to do their big bang thing in small codebase, or gradual thing in real world, legacy codebase (with so called "technical debt"). I agree this is changing namespace in code, seems trivial, but you discount that things needs to be tested, even for seemingly simple change, and it can be complex matter in many large codebases. This is why I want people to be able to do gradual switch, even for FSharp.Data.SqlClient abstraction, I don't want the package to prevent users to do the gradual upgrade in a larger codebase. In meantime, if people are in hurry, we can release a separate nuget, with a separate experimental branch or fork. |
smoothdeveloper commentedMay 16, 2025
I'm giving a look at the issues, starting with UDTT handling, without usage of the type provider. #r"nuget: Microsoft.SqlServer.Server"#r"nuget: Microsoft.Data.SqlClient"openMicrosoft.Data.SqlClientletconnectionString=@"Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True;TrustServerCertificate=true"douse cnx=new SqlConnection(connectionString) cnx.Open()use cmd= cnx.CreateCommand() cmd.CommandText<-"exec Person.myProc @x"letsqlMetas=[| Microsoft.Data.SqlClient.Server.SqlMetaData("myId", System.Data.SqlDbType.Int) Microsoft.Data.SqlClient.Server.SqlMetaData("myName", System.Data.SqlDbType.VarChar,30)|]letrecords=[|letr= Microsoft.Data.SqlClient.Server.SqlDataRecord(sqlMetas) r.SetValues(1,"monkey")|> ignore rletr= Microsoft.Data.SqlClient.Server.SqlDataRecord(sqlMetas) r.SetValues(2,"donkey")|> ignore r|] cmd.Parameters.AddWithValue("@x", records|> Array.toSeq)|> ignoreuse reader= cmd.ExecuteReader() ignore(reader.Read())letmyId= reader.GetInt32(0)letmyName= reader.GetString(1) printfn"%d%s" myId myName For now, in a script, under .net framework:
under dotnet 9:
|
Thorium commentedMay 16, 2025
For the runtime you need the best possible performance, so you want the SNI to be near. Luckily the proper runtime selection of Microsoft.Data.SqlClient.SNI.x64.dll will be handled by .NET runtime. However, for the compile-time and design-time, you don't know well the proper SNI but you still need to execute SQL. But in the design-time the milliseconds doesn't matter so much. That's why the |
Thorium commentedMay 16, 2025
In that sense, if you want to use Windows SNI directly from FSI then I think you need to add |

I recommend first accepting my other PR and making that a minor version, then consider this.
This PR has Microsoft.Data.SqlClient and both .NET Framework and NET8.0 compatibility.
Microsoft.SqlServer.Server.SqlDataRecordand these special SQL-server types