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
FbConnectionStringBuilder default values behavior [DNET281] #293
Comments
Commented by: Luigi Piccinni (luigi.piccinni) I tried to analyze this minor bug reported and solve it. I made the following changes (relate to the .cs files in attachment): Class FbConnectionString.cs (line 105 to 125) - Added some static readonly fields as default values for the connection strings Class FbConnectionString.cs, private method SetDefaultOptions() (line 396 to 416) - Modified the value of the pairs with the new declared default fields Class FbConnectionStringBuilder.cs, constructor FbConnectionStringBuilder() (line 166) - Line added that point to the new private method SetDefaultValues() Class FbConnectionStringBuilder.cs, private method SetDefaultValues() (line 241 to 264) - new method added Effect: This should cover both the point 1 and 2 of the bug reported. |
Modified by: Luigi Piccinni (luigi.piccinni)Attachment: FbConnectionString.cs [ 11580 ] Attachment: FbConnectionStringBuilder.cs [ 11581 ] |
Commented by: Jitka Dařbujanová (jitka) Any progress here Mr.Jiří? Jitka Dařbujanová |
Commented by: @cincuranet Hi Jitka, no progress so far nor plans. |
Commented by: Leonard Wennekers (l.wennekers) Hello I also added a new file FbConnectionStringBuilder.cs which does now what I expected and I hope that this new file will also be helpfull for many others and can be used in the next version of the Firebird .Net Dataprovider. Thanks in advance for looking to the new code. |
Modified by: Leonard Wennekers (l.wennekers)Attachment: dBDefaultValues.pdf [ 11900 ] Attachment: FbConnectionStringBuilder.cs [ 11901 ] |
Commented by: Leonard Wennekers (l.wennekers) Sorry I had the wrong PDF attatched. |
Modified by: Leonard Wennekers (l.wennekers)Attachment: dBDefaultValues.pdf [ 11902 ] |
Modified by: @cincuranetstatus: Open [ 1 ] => In Progress [ 3 ] |
Modified by: @cincuranetstatus: In Progress [ 3 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: vNext [ 10744 ] |
Submitted by: Vasily Kabanov (vaso)
Attachments:
FbConnectionString.cs
FbConnectionStringBuilder.cs
dBDefaultValues.pdf
FbConnectionStringBuilder.cs
dBDefaultValues.pdf
Votes: 3
1) None of the properties in the connection string builder appears to have default values: if you create new instance with parameterless constructor and try to get any property value you get an ArgumentException because all the properties directly query the base class for hard-coded key value. This is very different from other builders (such as SqlConnectionStringBuilder) and causes problems such as when you try to create database connection dialog for the user. All these defaults need to be implemented manually anyway in a wrapper.
fb.FbConnectionStringBuilder fbld = new fb.FbConnectionStringBuilder();
string userID = fbld.UserID; // throws exception
System.Data.SqlClient.SqlConnectionStringBuilder bld = new System.Data.SqlClient.SqlConnectionStringBuilder();
userID = bld.UserID; // returns empty string
2) If you set a property and then want to revert to default (delete key-value pair) there's no graceful way (for example, for integer properties) as key names are hard-coded as literals and not exposed (as public constants, for example). Also, after creating empty conn.string builder its Keys collection is empty which is again different from other implementations.
Commits: 2045647
The text was updated successfully, but these errors were encountered: