Skip to content
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

Feature Request: Have ConnectionString property use backward compatible keywords without spaces #2974

Open
deadlydog opened this issue Nov 5, 2024 · 2 comments
Labels
💡 Enhancement Issues that are feature requests for the drivers we maintain. ✔️ Triage Done Issues that are triaged by dev team and are in investigation.

Comments

@deadlydog
Copy link
Contributor

deadlydog commented Nov 5, 2024

Is your feature request related to a problem? Please describe.

Connection strings returned from the SqlConnectionStringBuilder are not always compatible with System.Data.SqlClient connection strings, even when they are using features supported by both. This is because the Microsoft.Data.SqlClient connection string introduced new aliases that are not supported by the System.Data.SqlClient connection string, such as Application Intent= instead of ApplicationIntent= (notice the space). There are many other keywords updated to include spaces that System.Data.SqlClient does not support.

This problem likely won't affect most apps, however, there are some scenarios where it will. For us, it affected our service-discovery service that other applications talk to in order to get the connection string they should use. Some of those other applications are still using System.Data.SqlClient, and thus the connection string returned by our service-discovery service was now invalid for those apps; they were receiving connection strings with Application Intent=ReadOnly in them instead of ApplicationIntent=ReadOnly, which is unsupported in System.Data.SqlClient.

When trying to use a Microsoft.Data.SqlClient connection string in an app connecting using System.Data.SqlClient, we received the following error:

Keyword not supported: 'application intent'

Describe the solution you'd like

It would be good if the SqlConnectionStringBuilder's .ConnectionString property used the backward compatible keywords, where applicable. For example, instead of returning a connection string with Application Intent= or Multi Subnet Failover= in it, it used ApplicationIntent= and MultiSubnetFailover= instead.

Describe alternatives you've considered

For now we've updated our service-discovery service to manually sanitize the connection string to use the backward compatible keywords, rather than just returning back the SqlConnectionStringBuilder.ConnectionString directly.

For this repo, if you choose to leave things as-is, we should at least add some documentation for this backward incompatibility.

Additional context

The new connection string format is a breaking change from System.Data.SqlClient. This seems like an easy way to restore backward compatibility.

@deadlydog
Copy link
Contributor Author

deadlydog commented Nov 5, 2024

I've created PR #2975 to mention the backward incompatibility in the docs for now, but it would still be nice to have SqlConnectionStringBuilder use the backward-compatible keywords by default.

@cheenamalhotra cheenamalhotra added the 🆕 Triage Needed For new issues, not triaged yet. label Nov 5, 2024
@samsharma2700 samsharma2700 added the 💡 Enhancement Issues that are feature requests for the drivers we maintain. label Nov 5, 2024
@samsharma2700
Copy link
Contributor

@David-Engel Looking for your input on this.

benrr101 pushed a commit that referenced this issue Nov 5, 2024
…pable connection string changes (#2975)

* docs: Update porting cheat sheet to include mention of backward incompatible connection string changes

Issue #2974

* docs: Adjust wording a bit
@samsharma2700 samsharma2700 added ✔️ Triage Done Issues that are triaged by dev team and are in investigation. and removed 🆕 Triage Needed For new issues, not triaged yet. labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Enhancement Issues that are feature requests for the drivers we maintain. ✔️ Triage Done Issues that are triaged by dev team and are in investigation.
Projects
None yet
Development

No branches or pull requests

3 participants