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 | SQL archive |
Timelines: | family | ancestors | descendants | both | designOptions |
Files: | files | file ages | folders |
SHA1: |
015eca543dfea4639fe6bbf716dca9cf |
User & Date: | mistachkin 2014-08-01 03:30:32 |
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 80 81 82 83 84 85 86 87 88 |
try { _typeQB = SQLiteDataAdapterToolboxItem._vsdesigner.GetType("Microsoft.VSDesigner.Data.Design.QueryBuilderControl"); if (_typeQB != null) { _queryDesigner = Activator.CreateInstance(_typeQB) as UserControl; // TODO: Fix me. _typeQB.InvokeMember("Provider", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { "System.Data.SQLite" }); _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; } |
< | |
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 26 27 28 29 30 31 32 33 34 |
{ public SQLiteConnectionProperties() : this(null) { } public SQLiteConnectionProperties(string connectionString) // TODO: Fix me. : base("System.Data.SQLite", connectionString) { } public override string[] GetBasicProperties() { return new string[] { "data source" }; } |
< | |
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
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 }); // TODO: Fix me. if (String.Compare(dataProvider, "System.Data.SQLite", StringComparison.OrdinalIgnoreCase) == 0) { node = selector.AddNode(connectionName, connectionString, null); if (String.Compare(connectionString, connection.ConnectionString, StringComparison.OrdinalIgnoreCase) == 0) selector.SelectedNode = node; } } selector.AddNode("<New Connection...>", this, null); } } } } |
| < |
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
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;
}
}
selector.AddNode("<New Connection...>", this, null);
}
}
}
}
|
Changes to SQLite.Designer/SQLiteDataAdapterToolboxItem.cs.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
/// <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) { // TODO: Fix me. DbProviderFactory fact = DbProviderFactories.GetFactory("System.Data.SQLite"); DbDataAdapter dataAdapter = fact.CreateDataAdapter(); IContainer container = host.Container; using (DbCommand adapterCommand = fact.CreateCommand()) { ICloneable adapter = (ICloneable)adapterCommand; |
< | |
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 26 27 28 29 30 31 32 33 34 |
internal sealed class SQLiteDataConnectionSupport : AdoDotNetConnectionSupport { private SQLiteDataViewSupport _dataViewSupport; private SQLiteDataObjectSupport _dataObjectSupport; private SQLiteDataObjectIdentifierResolver _dataObjectIdentifierResolver; public SQLiteDataConnectionSupport() // TODO: Fix me. : base("System.Data.SQLite") { } protected override DataSourceInformation CreateDataSourceInformation() { return new SQLiteDataSourceInformation(Site as DataConnection); } |
| < |
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 ... 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 ... 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 ... 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 ... 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
} } #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. ................................................................................ /// 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> GetOptionKeys( bool reset ) { lock (syncRoot) /* TRANSACTIONAL */ { Initialize(reset); ................................................................................ /// </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 HaveOptionKey( string key ) { lock (syncRoot) { if ((key == null) || (options == null)) return false; ................................................................................ /// <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 GetOptionValue( string key, out string value ) { lock (syncRoot) { value = null; ................................................................................ /// </param> /// <param name="value"> /// The new value for the configuration option. /// </param> /// <returns> /// Non-zero for success; otherwise, zero. /// </returns> public static bool SetOptionValue( string key, string value ) { lock (syncRoot) { if ((key == null) || (options == null)) |
> > > > > > > > > > > > > > > > > > > > > > > > | | | | |
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 ... 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 ... 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 ... 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 ... 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
} } #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. ................................................................................ /// 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); ................................................................................ /// </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; ................................................................................ /// <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; ................................................................................ /// </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
27
28
29
30
31
32
33
34
..
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
|
/// 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.GetOptionKeys(true); if (keys != null) { foreach (string key in keys) { if (key == null) continue; ................................................................................ ToolboxInitialized += new EventHandler(SQLitePackage_ToolboxInitialized); ToolboxUpgraded += new EventHandler(SQLitePackage_ToolboxUpgraded); base.Initialize(); } protected override void OnLoadOptions(string key, Stream stream) { if (SQLiteOptions.HaveOptionKey(key)) { string value; if (SQLiteOptions.ReadValue(stream, out value) && SQLiteOptions.IsValidValue(key, value)) { SQLiteOptions.SetOptionValue(key, value); } return; } base.OnLoadOptions(key, stream); } protected override void OnSaveOptions(string key, Stream stream) { if (SQLiteOptions.HaveOptionKey(key)) { string value; if (SQLiteOptions.GetOptionValue(key, out value) && SQLiteOptions.IsValidValue(key, value) && !SQLiteOptions.IsDefaultValue(key, value)) { SQLiteOptions.WriteValue(stream, value); } return; |
|
|
|
|
|
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
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
|
/// 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;
................................................................................
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;
|