Description:
Hi, I'd like to specify custom attributes in my Connection Attributes, which will be very useful for Performance Scheme related diagnostics etc.
I notice on the documentation there's mention of "Connect_Attrs", however they seem to be unmentioned anywhere in the code. And attempting to set that settings causes this error
System.ArgumentException: Keyword not supported.
Parameter name: connect_attrs
at MySql.Data.MySqlClient.MySqlConnectionStringBuilder.GetOption(String key)
at MySql.Data.MySqlClient.MySqlConnectionStringBuilder.set_Item(String keyword, Object value)
at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
at MySql.Data.MySqlClient.MySqlConnectionStringBuilder..ctor(String connStr)
How to repeat:
Attempt to set some Connection Attributes in the connectionstring.
Suggested fix:
May I recommend these additions (Taken from 6.9.5's latest source)
MySqlConnectionStringBuilder.cs @ line 190
+ options.Add(new MySqlConnectionStringOption("connectattrs", "connect_attrs,connection attributes", typeof(string), "", false));
MySqlConnectionStringBuilder.cs @ line 791
+[Category("Advanced")]
+[DisplayName("Connection Attributes")]
+[Description("A Comma separated <key>:<value> list of extra connection attributes")]
+public string ConnectionAttributes
+{
+ get { return (string)values["connectattrs"]; }
+ set { SetValue("connectattrs", value); }
+}
NativeDriver.cs @ line 931
+//Now join in some custom attributes
+if (owner.Settings.ConnectionAttributes != null)
+{
+ string[] attributes = owner.Settings.ConnectionAttributes.Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries);
+ string[] attributePair;
+ foreach (string attributeKeyValue in attributes) {
+ attributePair = attributeKeyValue.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
+ if (attributePair.Length == 2)
+ {
+ connectAttrs += string.Format("{0}{1}", (char)attributePair[0].Length, attributePair[0]);
+ connectAttrs += string.Format("{0}{1}", (char)attributePair[1].Length, attributePair[1]);
+ }
+ }
+}