Skip to content

Using Microsoft.Data.SqlClient instead of System.Data.SqlClient #40

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

Closed
KlemensGenetec opened this issue Dec 22, 2023 · 12 comments
Closed

Comments

@KlemensGenetec
Copy link

Since new feature development of System.Data.SqlClient pretty much stopped and some features like Authentication via Workload identities is already not supported, why not switch to Microsoft.Data.SqlClient?

Trying to get it to use the new version is very simple since all currently supported versions are supported by the new SqlClient. Trying to do it in the project pretty much only needed a 2 line change.

I can also create a PR for this if its something that would be acceptable.

Thanks!

@esbenbach
Copy link

Actually, we are now at a point where System.Data.SqlClient is no longer compatible with NET8.
I will create a PR for this and hope it gets some traction because we are stuck right now :(

@KlemensGenetec
Copy link
Author

Well its still compatible and we are using it with net 8. but its lacking critical features.

@esbenbach
Copy link

Well, compatible unless you are affected by the bug i referenced in the PR :-)
We have som reflection discovery code that breaks on net8 due to system.data.sqlclient

@AGiorgetti
Copy link
Member

Thanks @esbenbach for your PR, there's some more work to do (like updating properly the nuspec files and fixing some references here and there).
I'll start from your code and create a spike completely replacing System.Data.SqlClient with Microsoft.Data.SqlClient even for net462 to see if all tests are green.

@esbenbach
Copy link

@AGiorgetti - okay, let me know if I need to do some more on it. A complete replacement would probably be easier to maintain in the long run :)

AGiorgetti added a commit that referenced this issue Apr 18, 2024
…ent`

This commit includes a significant change where the `System.Data.SqlClient` package has been replaced with `Microsoft.Data.SqlClient` across multiple files. This is a breaking change and is highlighted in the `Changelog.md` file. The `Microsoft.Data.SqlClient` package is the latest and recommended data provider for SQL Server.

The connection string for `NEventStore.MsSql` in the `README.md` file has been updated. The `.editorconfig` file now includes new rules for code formatting and style. The `NEventStore.Persistence.Sql.nuspec` file and several project files have been updated to replace the `System.Data.SqlClient` dependency with `Microsoft.Data.SqlClient`.

Several test files have been updated to use `Microsoft.Data.SqlClient` and their code formatting has been updated. The `using System.Data.SqlClient;` and `using Microsoft.Data.SqlClient;` statements have been removed from the `MsSqlDialect.cs` file, and the `using System;` statement has been added.

The `#if NET462` preprocessor directive and its associated code have been removed. The `SqlException` class from the `System.Data.SqlClient` namespace has been replaced with the `SqlException` class from the `Microsoft.Data.SqlClient` namespace in the `IsDuplicate` method.

Lastly, the `MsSqlDialect` and `MsSql2005Dialect` classes have been restructured but their functionality remains the same.
@AGiorgetti
Copy link
Member

I wasn't able to push new commits on yout branch, so I created another one incorporating you commits (this way our build machine can run all the tests).

Take a look at this PR: #44 .

If it's all good we can close it and release a new version.

AGiorgetti added a commit that referenced this issue Apr 18, 2024
…ent`

This commit includes a significant change where the `System.Data.SqlClient` package has been replaced with `Microsoft.Data.SqlClient` across multiple files. This is a breaking change and is highlighted in the `Changelog.md` file. The `Microsoft.Data.SqlClient` package is the latest and recommended data provider for SQL Server.

The connection string for `NEventStore.MsSql` in the `README.md` file has been updated. The `.editorconfig` file now includes new rules for code formatting and style. The `NEventStore.Persistence.Sql.nuspec` file and several project files have been updated to replace the `System.Data.SqlClient` dependency with `Microsoft.Data.SqlClient`.

Several test files have been updated to use `Microsoft.Data.SqlClient` and their code formatting has been updated. The `using System.Data.SqlClient;` and `using Microsoft.Data.SqlClient;` statements have been removed from the `MsSqlDialect.cs` file, and the `using System;` statement has been added.

The `#if NET462` preprocessor directive and its associated code have been removed. The `SqlException` class from the `System.Data.SqlClient` namespace has been replaced with the `SqlException` class from the `Microsoft.Data.SqlClient` namespace in the `IsDuplicate` method.

Lastly, the `MsSqlDialect` and `MsSql2005Dialect` classes have been restructured but their functionality remains the same.
@AGiorgetti
Copy link
Member

closed in #44

@esbenbach
Copy link

How are changes published to NuGet - noticed there is nothing there yet, but unaware if something manual needs to be done in order for you to publish the resulting package.

@AGiorgetti
Copy link
Member

It should be up in minutes, I had some issues with the build agent.

@KlemensGenetec
Copy link
Author

Unfortunately i still don't see it in the releases. Did it every complete?

@esbenbach
Copy link

Yearh its tagged, its on nuget (and working mind you), but its missing from the releases section GH. A manual step missing presumably :)

@KlemensGenetec
Copy link
Author

oh thats amazing. finally can get rid of the old system.data.sql package completely. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants