Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improve the robustness of the new provider name option handling in the design-time components. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | designOptions |
Files: | files | file ages | folders |
SHA1: |
592e679ca6f4e1af9520950d402669c2 |
User & Date: | mistachkin 2014-09-03 18:38:09.722 |
Context
2014-09-04
| ||
03:30 | Merge updates from trunk. Closed-Leaf check-in: 8dba4cc370 user: mistachkin tags: designOptions | |
2014-09-03
| ||
18:38 | Improve the robustness of the new provider name option handling in the design-time components. check-in: 592e679ca6 user: mistachkin tags: designOptions | |
2014-08-20
| ||
19:40 | Merge updates from trunk. check-in: e3dd6dc7e0 user: mistachkin tags: designOptions | |
Changes
Changes to SQLite.Designer/SQLiteOptions.cs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Joe Mistachkin (joe@mistachkin.com) * * Released to the public domain, use at your own risk! ********************************************************/ using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; using Microsoft.VisualStudio.Shell; namespace SQLite.Designer { | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Joe Mistachkin (joe@mistachkin.com) * * Released to the public domain, use at your own risk! ********************************************************/ using System; using System.Collections.Generic; using System.Data.Common; using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; using Microsoft.VisualStudio.Shell; namespace SQLite.Designer { |
︙ | ︙ | |||
124 125 126 127 128 129 130 131 132 133 134 135 136 137 | /// </summary> /// <returns> /// The configured ADO.NET provider name for System.Data.SQLite -OR- /// the default ADO.NET provider name for System.Data.SQLite in the /// event of any failure. This method cannot return null. /// </returns> public static string GetProviderName() { string key = ProviderNameKey; string value; if (GetValue(key, out value) && IsValidValue(key, value)) return value; | > > > > > > > > > > > > > > > > > > > > > > | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | /// </summary> /// <returns> /// The configured ADO.NET provider name for System.Data.SQLite -OR- /// the default ADO.NET provider name for System.Data.SQLite in the /// event of any failure. This method cannot return null. /// </returns> public static string GetProviderName() { return GetProviderName(DefaultProviderName); } /////////////////////////////////////////////////////////////////////// /// <summary> /// This method determines the name of the ADO.NET provider for the /// System.Data.SQLite design-time components to use. /// </summary> /// <param name="default"> /// The value to return from this method if the name of the ADO.NET /// provider is unavailable -OR- cannot be determined. /// </param> /// <returns> /// The configured ADO.NET provider name for System.Data.SQLite -OR- /// the default ADO.NET provider name for System.Data.SQLite in the /// event of any failure. /// </returns> private static string GetProviderName( string @default ) { string key = ProviderNameKey; string value; if (GetValue(key, out value) && IsValidValue(key, value)) return value; return @default; } /////////////////////////////////////////////////////////////////////// /// <summary> /// This method attempts to set the name of the ADO.NET provider for /// the System.Data.SQLite design-time components to use. |
︙ | ︙ | |||
181 182 183 184 185 186 187 | public static bool SelectProviderName( ComboBox comboBox ) { if (comboBox == null) return false; | | < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | public static bool SelectProviderName( ComboBox comboBox ) { if (comboBox == null) return false; string value = GetProviderName(null); for (int index = 0; index < comboBox.Items.Count; index++) { object item = comboBox.Items[index]; if (item == null) continue; if ((value == null) || String.Equals( item.ToString(), value, StringComparison.Ordinal)) { comboBox.SelectedIndex = index; return true; } } return false; } /////////////////////////////////////////////////////////////////////// private static bool CheckProviderName( string name ) { DbProviderFactory dbProviderFactory = null; try { dbProviderFactory = DbProviderFactories.GetFactory( name); /* throw */ return (dbProviderFactory != null); } catch { // do nothing. } finally { if (dbProviderFactory != null) { IDisposable disposable = dbProviderFactory as IDisposable; if (disposable != null) { disposable.Dispose(); disposable = null; } dbProviderFactory = null; } } return false; } /////////////////////////////////////////////////////////////////////// /// <summary> |
︙ | ︙ | |||
227 228 229 230 231 232 233 | ) { int result = 0; if (items == null) return result; | > > > > > > | | > | | > | | < > > | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | ) { int result = 0; if (items == null) return result; IList<string> names = new List<string>(); #if NET_40 || NET_45 || NET_451 names.Add(Ef6ProviderName); #endif names.Add(DefaultProviderName); foreach (string name in names) { if (CheckProviderName(name)) { items.Add(name); result++; } } return result; } #endregion #endregion /////////////////////////////////////////////////////////////////////// |
︙ | ︙ |