Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Revise method names introduced in the previous check-in. Call the SQLiteOptions class from all the appropriate places. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | designOptions |
Files: | files | file ages | folders |
SHA1: |
015eca543dfea4639fe6bbf716dca9cf |
User & Date: | mistachkin 2014-08-01 03:30:32.773 |
Context
2014-08-01
| ||
04:24 | Add user-interface integration for the per-solution provider name configuration option. check-in: 1e8b52743b user: mistachkin tags: designOptions | |
03:30 | Revise method names introduced in the previous check-in. Call the SQLiteOptions class from all the appropriate places. check-in: 015eca543d user: mistachkin tags: designOptions | |
03:12 | Initial support for loading/saving options in the design-time components. check-in: b26261e090 user: mistachkin tags: designOptions | |
Changes
Changes to SQLite.Designer/Editors/ViewDesignerDoc.cs.
︙ | ︙ | |||
73 74 75 76 77 78 79 | try { _typeQB = SQLiteDataAdapterToolboxItem._vsdesigner.GetType("Microsoft.VSDesigner.Data.Design.QueryBuilderControl"); if (_typeQB != null) { _queryDesigner = Activator.CreateInstance(_typeQB) as UserControl; | < | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | try { _typeQB = SQLiteDataAdapterToolboxItem._vsdesigner.GetType("Microsoft.VSDesigner.Data.Design.QueryBuilderControl"); if (_typeQB != null) { _queryDesigner = Activator.CreateInstance(_typeQB) as UserControl; _typeQB.InvokeMember("Provider", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { SQLiteOptions.GetProviderName() }); _typeQB.InvokeMember("ConnectionString", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { _connection.ConnectionSupport.ConnectionString }); _typeQB.InvokeMember("EnableMorphing", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { false }); Controls.Add(_queryDesigner); _queryDesigner.Dock = DockStyle.Fill; _queryDesigner.Visible = true; } |
︙ | ︙ |
Changes to SQLite.Designer/SQLiteConnectionProperties.cs.
︙ | ︙ | |||
19 20 21 22 23 24 25 | { public SQLiteConnectionProperties() : this(null) { } public SQLiteConnectionProperties(string connectionString) | < | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | { public SQLiteConnectionProperties() : this(null) { } public SQLiteConnectionProperties(string connectionString) : base(SQLiteOptions.GetProviderName(), connectionString) { } public override string[] GetBasicProperties() { return new string[] { "data source" }; } |
︙ | ︙ |
Changes to SQLite.Designer/SQLiteConnectionStringEditor.cs.
︙ | ︙ | |||
100 101 102 103 104 105 106 | string connectionName; for (int n = 0; n < items; n++) { connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n }); connectionName = (string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n }); dataProvider = (string)_managerType.InvokeMember("GetProvider", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n }); | < | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | string connectionName; for (int n = 0; n < items; n++) { connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n }); connectionName = (string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n }); dataProvider = (string)_managerType.InvokeMember("GetProvider", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n }); if (String.Compare(dataProvider, SQLiteOptions.GetProviderName(), StringComparison.OrdinalIgnoreCase) == 0) { node = selector.AddNode(connectionName, connectionString, null); if (String.Compare(connectionString, connection.ConnectionString, StringComparison.OrdinalIgnoreCase) == 0) selector.SelectedNode = node; } } |
︙ | ︙ |
Changes to SQLite.Designer/SQLiteDataAdapterToolboxItem.cs.
︙ | ︙ | |||
59 60 61 62 63 64 65 | /// <summary> /// Creates the necessary components associated with this data adapter instance /// </summary> /// <param name="host">The designer host</param> /// <returns>The components created by this toolbox item</returns> protected override IComponent[] CreateComponentsCore(IDesignerHost host) { | < | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | /// <summary> /// Creates the necessary components associated with this data adapter instance /// </summary> /// <param name="host">The designer host</param> /// <returns>The components created by this toolbox item</returns> protected override IComponent[] CreateComponentsCore(IDesignerHost host) { DbProviderFactory fact = DbProviderFactories.GetFactory(SQLiteOptions.GetProviderName()); DbDataAdapter dataAdapter = fact.CreateDataAdapter(); IContainer container = host.Container; using (DbCommand adapterCommand = fact.CreateCommand()) { ICloneable adapter = (ICloneable)adapterCommand; |
︙ | ︙ |
Changes to SQLite.Designer/SQLiteDataConnectionSupport.cs.
︙ | ︙ | |||
19 20 21 22 23 24 25 | internal sealed class SQLiteDataConnectionSupport : AdoDotNetConnectionSupport { private SQLiteDataViewSupport _dataViewSupport; private SQLiteDataObjectSupport _dataObjectSupport; private SQLiteDataObjectIdentifierResolver _dataObjectIdentifierResolver; public SQLiteDataConnectionSupport() | < | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | internal sealed class SQLiteDataConnectionSupport : AdoDotNetConnectionSupport { private SQLiteDataViewSupport _dataViewSupport; private SQLiteDataObjectSupport _dataObjectSupport; private SQLiteDataObjectIdentifierResolver _dataObjectIdentifierResolver; public SQLiteDataConnectionSupport() : base(SQLiteOptions.GetProviderName()) { } protected override DataSourceInformation CreateDataSourceInformation() { return new SQLiteDataSourceInformation(Site as DataConnection); } |
︙ | ︙ |
Changes to SQLite.Designer/SQLiteOptions.cs.
︙ | ︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | } } #endregion /////////////////////////////////////////////////////////////////////// #region Public Static Methods #region Hard-Coded Default Value Handling /// <summary> /// This method determines if the specified key/value pair represents /// the default value for that option. /// </summary> /// <param name="key"> /// The name ("key") of the configuration option. | > > > > > > > > > > > > > > > > > > > > > > > > | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | } } #endregion /////////////////////////////////////////////////////////////////////// #region Public Static Methods #region Provider Name Handling /// <summary> /// This method determines the name of the ADO.NET provider for the /// System.Data.SQLite design-time components to use. /// </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; return DefaultProviderName; } #endregion /////////////////////////////////////////////////////////////////////// #region Hard-Coded Default Value Handling /// <summary> /// This method determines if the specified key/value pair represents /// the default value for that option. /// </summary> /// <param name="key"> /// The name ("key") of the configuration option. |
︙ | ︙ | |||
163 164 165 166 167 168 169 | /// the System.Data.SQLite design-time components. /// </summary> /// <returns> /// An <see cref="IEnumerable{T}" /> of strings containing the list of /// option keys supported by the System.Data.SQLite design-time /// components -OR- null in the event of any failure. /// </returns> | | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | /// the System.Data.SQLite design-time components. /// </summary> /// <returns> /// An <see cref="IEnumerable{T}" /> of strings containing the list of /// option keys supported by the System.Data.SQLite design-time /// components -OR- null in the event of any failure. /// </returns> public static IEnumerable<string> GetKeys( bool reset ) { lock (syncRoot) /* TRANSACTIONAL */ { Initialize(reset); |
︙ | ︙ | |||
188 189 190 191 192 193 194 | /// </summary> /// <param name="key"> /// The name ("key") of the configuration option. /// </param> /// <returns> /// Non-zero if the specified option key is supported by this class. /// </returns> | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | /// </summary> /// <param name="key"> /// The name ("key") of the configuration option. /// </param> /// <returns> /// Non-zero if the specified option key is supported by this class. /// </returns> public static bool HaveKey( string key ) { lock (syncRoot) { if ((key == null) || (options == null)) return false; |
︙ | ︙ | |||
217 218 219 220 221 222 223 | /// <param name="value"> /// Upon success, the current value for the configuration option; /// otherwise, null. /// </param> /// <returns> /// Non-zero for success; otherwise, zero. /// </returns> | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | /// <param name="value"> /// Upon success, the current value for the configuration option; /// otherwise, null. /// </param> /// <returns> /// Non-zero for success; otherwise, zero. /// </returns> public static bool GetValue( string key, out string value ) { lock (syncRoot) { value = null; |
︙ | ︙ | |||
250 251 252 253 254 255 256 | /// </param> /// <param name="value"> /// The new value for the configuration option. /// </param> /// <returns> /// Non-zero for success; otherwise, zero. /// </returns> | | | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | /// </param> /// <param name="value"> /// The new value for the configuration option. /// </param> /// <returns> /// Non-zero for success; otherwise, zero. /// </returns> public static bool SetValue( string key, string value ) { lock (syncRoot) { if ((key == null) || (options == null)) |
︙ | ︙ |
Changes to SQLite.Designer/SQLitePackage.cs.
︙ | ︙ | |||
20 21 22 23 24 25 26 | /// exists so that in the future we can perhaps work with the Express Editions. /// </summary> [Guid("DCBE6C8D-0E57-4099-A183-98FF74C64D9C")] internal sealed class SQLitePackage : Package { public SQLitePackage() { | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /// exists so that in the future we can perhaps work with the Express Editions. /// </summary> [Guid("DCBE6C8D-0E57-4099-A183-98FF74C64D9C")] internal sealed class SQLitePackage : Package { public SQLitePackage() { IEnumerable<string> keys = SQLiteOptions.GetKeys(true); if (keys != null) { foreach (string key in keys) { if (key == null) continue; |
︙ | ︙ | |||
46 47 48 49 50 51 52 | ToolboxInitialized += new EventHandler(SQLitePackage_ToolboxInitialized); ToolboxUpgraded += new EventHandler(SQLitePackage_ToolboxUpgraded); base.Initialize(); } protected override void OnLoadOptions(string key, Stream stream) { | | | | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | ToolboxInitialized += new EventHandler(SQLitePackage_ToolboxInitialized); ToolboxUpgraded += new EventHandler(SQLitePackage_ToolboxUpgraded); base.Initialize(); } protected override void OnLoadOptions(string key, Stream stream) { if (SQLiteOptions.HaveKey(key)) { string value; if (SQLiteOptions.ReadValue(stream, out value) && SQLiteOptions.IsValidValue(key, value)) { SQLiteOptions.SetValue(key, value); } return; } base.OnLoadOptions(key, stream); } protected override void OnSaveOptions(string key, Stream stream) { if (SQLiteOptions.HaveKey(key)) { string value; if (SQLiteOptions.GetValue(key, out value) && SQLiteOptions.IsValidValue(key, value) && !SQLiteOptions.IsDefaultValue(key, value)) { SQLiteOptions.WriteValue(stream, value); } return; |
︙ | ︙ |