12 changed files with 1047 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||||||
|
using System.Reflection; |
||||||
|
using System.Runtime.CompilerServices; |
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("SharpDbTools")] |
||||||
|
[assembly: AssemblyDescription("Addin for SharpDevelop 2.0")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyCompany("")] |
||||||
|
[assembly: AssemblyProduct("SharpDevelop")] |
||||||
|
[assembly: AssemblyCopyright("")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")] |
||||||
|
|
@ -0,0 +1,25 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Components version="1.0"> |
||||||
|
<System.Windows.Forms.UserControl> |
||||||
|
<Name value="MyUserControl" /> |
||||||
|
<ClientSize value="{Width=230, Height=160}" /> |
||||||
|
<Controls> |
||||||
|
<System.Windows.Forms.Button> |
||||||
|
<Name value="testButton" /> |
||||||
|
<Location value="{X=63,Y=97}" /> |
||||||
|
<Text value="A button" /> |
||||||
|
<Size value="{Width=75, Height=23}" /> |
||||||
|
<Anchor value="None" /> |
||||||
|
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
||||||
|
<TabIndex value="1" /> |
||||||
|
</System.Windows.Forms.Button> |
||||||
|
<System.Windows.Forms.Label> |
||||||
|
<Name value="label1" /> |
||||||
|
<Location value="{X=38,Y=19}" /> |
||||||
|
<Text value="Hello, World!" /> |
||||||
|
<Size value="{Width=100, Height=23}" /> |
||||||
|
<TabIndex value="0" /> |
||||||
|
</System.Windows.Forms.Label> |
||||||
|
</Controls> |
||||||
|
</System.Windows.Forms.UserControl> |
||||||
|
</Components> |
@ -0,0 +1,18 @@ |
|||||||
|
<AddIn name = "SharpDbTools" |
||||||
|
author = "Dickon Field" |
||||||
|
url = "" |
||||||
|
description = "A collection of components and tools to help develop db-aware apps"> |
||||||
|
|
||||||
|
<Runtime> |
||||||
|
<Import assembly = "SharpDbTools.dll"/> |
||||||
|
</Runtime> |
||||||
|
|
||||||
|
<Path name = "/SharpDevelop/Workbench/Pads"> |
||||||
|
<Pad id = "SharpDbToolsPad" |
||||||
|
category = "Main" |
||||||
|
title = "RDB Server Tools" |
||||||
|
icon = "PadIcons.Output" |
||||||
|
shortcut = "Control|Alt|D" |
||||||
|
class = "SharpDbTools.ServerBrowserTool"/> |
||||||
|
</Path> |
||||||
|
</AddIn> |
@ -0,0 +1,76 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<RootNamespace>SharpDbTools</RootNamespace> |
||||||
|
<AssemblyName>SharpDbTools</AssemblyName> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<ProjectGuid>{413A467D-7EA1-4C40-B10B-D6832B94DD6E}</ProjectGuid> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<RegisterForComInterop>False</RegisterForComInterop> |
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||||
|
<BaseAddress>4194304</BaseAddress> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
<FileAlignment>4096</FileAlignment> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||||
|
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> |
||||||
|
<IntermediateOutputPath>obj\Debug\</IntermediateOutputPath> |
||||||
|
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpDbTools\</OutputPath> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||||
|
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> |
||||||
|
<IntermediateOutputPath>obj\Release\</IntermediateOutputPath> |
||||||
|
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpDbTools\</OutputPath> |
||||||
|
<Optimize>True</Optimize> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
<DebugSymbols>false</DebugSymbols> |
||||||
|
<DebugType>None</DebugType> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Data" /> |
||||||
|
<Reference Include="System.Drawing" /> |
||||||
|
<Reference Include="System.Windows.Forms" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<None Include="SharpDbTools.addin"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<EmbeddedResource Include="Resources\MyUserControl.xfrm" /> |
||||||
|
<Compile Include="Src\ServerBrowserTool.cs" /> |
||||||
|
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||||
|
<Compile Include="Src\DbProvidersService.cs" /> |
||||||
|
<Compile Include="Src\ConnectionStringDefinitionDialog.cs" /> |
||||||
|
<Compile Include="Src\ConnectionStringDefinitionDialog.Designer.cs" /> |
||||||
|
<EmbeddedResource Include="Src\ConnectionStringDefinitionDialog.resx"> |
||||||
|
<DependentUpon>ConnectionStringDefinitionDialog.cs</DependentUpon> |
||||||
|
</EmbeddedResource> |
||||||
|
<Compile Include="Src\Model\DbConnectionInfo.cs" /> |
||||||
|
<Compile Include="Src\Model\DbModelInfo.cs" /> |
||||||
|
<Compile Include="Src\Model\IConnectionInfo.cs" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Folder Include="Src\Model" /> |
||||||
|
<Folder Include="Src\Connection" /> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||||
|
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop</Name> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||||
|
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||||
|
<Name>ICSharpCode.Core</Name> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
</Project> |
@ -0,0 +1,239 @@ |
|||||||
|
/* |
||||||
|
* Responsibilities:<br> |
||||||
|
* <br> |
||||||
|
* Collaboration:<br> |
||||||
|
* <br> |
||||||
|
* User: ${USER} |
||||||
|
* Date: ${DATE} |
||||||
|
* Time: ${TIME} |
||||||
|
* |
||||||
|
*/ |
||||||
|
namespace SharpDbTools.Connection |
||||||
|
{ |
||||||
|
partial class ConnectionStringDefinitionDialog : System.Windows.Forms.Form |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Designer variable used to keep track of non-visual components.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disposes resources used by the form.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing) |
||||||
|
{ |
||||||
|
if (disposing) { |
||||||
|
if (components != null) { |
||||||
|
components.Dispose(); |
||||||
|
} |
||||||
|
} |
||||||
|
base.Dispose(disposing); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This method is required for Windows Forms designer support.
|
||||||
|
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||||
|
/// not be able to load this method if it was changed manually.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent() |
||||||
|
{ |
||||||
|
this.components = new System.ComponentModel.Container(); |
||||||
|
this.connStringPropertyGrid = new System.Windows.Forms.PropertyGrid(); |
||||||
|
this.buttonsFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); |
||||||
|
this.testButton = new System.Windows.Forms.Button(); |
||||||
|
this.submitButton = new System.Windows.Forms.Button(); |
||||||
|
this.cancelButton = new System.Windows.Forms.Button(); |
||||||
|
this.providerTypeComboBox = new System.Windows.Forms.ComboBox(); |
||||||
|
this.dataSourceTypeLabel = new System.Windows.Forms.Label(); |
||||||
|
this.connStringResult = new System.Windows.Forms.TextBox(); |
||||||
|
this.connectionStringLabel = new System.Windows.Forms.Label(); |
||||||
|
this.progressTimer = new System.Windows.Forms.Timer(this.components); |
||||||
|
this.statusStrip = new System.Windows.Forms.StatusStrip(); |
||||||
|
this.outputMessageTabControl = new System.Windows.Forms.TabControl(); |
||||||
|
this.connectionStringTab = new System.Windows.Forms.TabPage(); |
||||||
|
this.testResultTab = new System.Windows.Forms.TabPage(); |
||||||
|
this.testResultTextBox = new System.Windows.Forms.TextBox(); |
||||||
|
this.buttonsFlowLayoutPanel.SuspendLayout(); |
||||||
|
this.outputMessageTabControl.SuspendLayout(); |
||||||
|
this.connectionStringTab.SuspendLayout(); |
||||||
|
this.testResultTab.SuspendLayout(); |
||||||
|
this.SuspendLayout(); |
||||||
|
//
|
||||||
|
// connStringPropertyGrid
|
||||||
|
//
|
||||||
|
this.connStringPropertyGrid.Location = new System.Drawing.Point(0, 39); |
||||||
|
this.connStringPropertyGrid.Name = "connStringPropertyGrid"; |
||||||
|
this.connStringPropertyGrid.Size = new System.Drawing.Size(547, 300); |
||||||
|
this.connStringPropertyGrid.TabIndex = 0; |
||||||
|
//
|
||||||
|
// buttonsFlowLayoutPanel
|
||||||
|
//
|
||||||
|
this.buttonsFlowLayoutPanel.Controls.Add(this.testButton); |
||||||
|
this.buttonsFlowLayoutPanel.Controls.Add(this.submitButton); |
||||||
|
this.buttonsFlowLayoutPanel.Controls.Add(this.cancelButton); |
||||||
|
this.buttonsFlowLayoutPanel.Location = new System.Drawing.Point(3, 447); |
||||||
|
this.buttonsFlowLayoutPanel.Name = "buttonsFlowLayoutPanel"; |
||||||
|
this.buttonsFlowLayoutPanel.Size = new System.Drawing.Size(312, 34); |
||||||
|
this.buttonsFlowLayoutPanel.TabIndex = 1; |
||||||
|
//
|
||||||
|
// testButton
|
||||||
|
//
|
||||||
|
this.testButton.Location = new System.Drawing.Point(3, 3); |
||||||
|
this.testButton.Name = "testButton"; |
||||||
|
this.testButton.Size = new System.Drawing.Size(75, 23); |
||||||
|
this.testButton.TabIndex = 0; |
||||||
|
this.testButton.Text = "Test"; |
||||||
|
this.testButton.UseVisualStyleBackColor = true; |
||||||
|
this.testButton.Click += new System.EventHandler(this.TestButtonClick); |
||||||
|
//
|
||||||
|
// submitButton
|
||||||
|
//
|
||||||
|
this.submitButton.Location = new System.Drawing.Point(84, 3); |
||||||
|
this.submitButton.Name = "submitButton"; |
||||||
|
this.submitButton.Size = new System.Drawing.Size(75, 23); |
||||||
|
this.submitButton.TabIndex = 1; |
||||||
|
this.submitButton.Text = "Submit"; |
||||||
|
this.submitButton.UseVisualStyleBackColor = true; |
||||||
|
this.submitButton.Click += new System.EventHandler(this.SubmitButtonClick); |
||||||
|
//
|
||||||
|
// cancelButton
|
||||||
|
//
|
||||||
|
this.cancelButton.Location = new System.Drawing.Point(165, 3); |
||||||
|
this.cancelButton.Name = "cancelButton"; |
||||||
|
this.cancelButton.Size = new System.Drawing.Size(75, 23); |
||||||
|
this.cancelButton.TabIndex = 2; |
||||||
|
this.cancelButton.Text = "Cancel"; |
||||||
|
this.cancelButton.UseVisualStyleBackColor = true; |
||||||
|
this.cancelButton.Click += new System.EventHandler(this.CancelButtonClick); |
||||||
|
//
|
||||||
|
// providerTypeComboBox
|
||||||
|
//
|
||||||
|
this.providerTypeComboBox.FormattingEnabled = true; |
||||||
|
this.providerTypeComboBox.Location = new System.Drawing.Point(117, 12); |
||||||
|
this.providerTypeComboBox.Name = "providerTypeComboBox"; |
||||||
|
this.providerTypeComboBox.Size = new System.Drawing.Size(195, 21); |
||||||
|
this.providerTypeComboBox.TabIndex = 2; |
||||||
|
this.providerTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.ProviderTypeSelectedIndexChanged); |
||||||
|
//
|
||||||
|
// dataSourceTypeLabel
|
||||||
|
//
|
||||||
|
this.dataSourceTypeLabel.Location = new System.Drawing.Point(3, 9); |
||||||
|
this.dataSourceTypeLabel.Name = "dataSourceTypeLabel"; |
||||||
|
this.dataSourceTypeLabel.Size = new System.Drawing.Size(108, 23); |
||||||
|
this.dataSourceTypeLabel.TabIndex = 3; |
||||||
|
this.dataSourceTypeLabel.Text = "Data Source Type:"; |
||||||
|
this.dataSourceTypeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; |
||||||
|
//
|
||||||
|
// connStringResult
|
||||||
|
//
|
||||||
|
this.connStringResult.Enabled = false; |
||||||
|
this.connStringResult.Location = new System.Drawing.Point(0, 0); |
||||||
|
this.connStringResult.Multiline = true; |
||||||
|
this.connStringResult.Name = "connStringResult"; |
||||||
|
this.connStringResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; |
||||||
|
this.connStringResult.Size = new System.Drawing.Size(413, 74); |
||||||
|
this.connStringResult.TabIndex = 4; |
||||||
|
//
|
||||||
|
// connectionStringLabel
|
||||||
|
//
|
||||||
|
this.connectionStringLabel.Location = new System.Drawing.Point(12, 348); |
||||||
|
this.connectionStringLabel.Name = "connectionStringLabel"; |
||||||
|
this.connectionStringLabel.Size = new System.Drawing.Size(100, 23); |
||||||
|
this.connectionStringLabel.TabIndex = 5; |
||||||
|
this.connectionStringLabel.Text = "Connection String:"; |
||||||
|
//
|
||||||
|
// progressTimer
|
||||||
|
//
|
||||||
|
this.progressTimer.Interval = 1000; |
||||||
|
this.progressTimer.Tick += new System.EventHandler(this.ProgressTimerTick); |
||||||
|
//
|
||||||
|
// statusStrip
|
||||||
|
//
|
||||||
|
this.statusStrip.Location = new System.Drawing.Point(0, 478); |
||||||
|
this.statusStrip.Name = "statusStrip"; |
||||||
|
this.statusStrip.Size = new System.Drawing.Size(547, 22); |
||||||
|
this.statusStrip.TabIndex = 6; |
||||||
|
this.statusStrip.Text = "statusStrip1"; |
||||||
|
//
|
||||||
|
// testResultTab
|
||||||
|
//
|
||||||
|
this.outputMessageTabControl.Controls.Add(this.connectionStringTab); |
||||||
|
this.outputMessageTabControl.Controls.Add(this.testResultTab); |
||||||
|
this.outputMessageTabControl.Location = new System.Drawing.Point(118, 345); |
||||||
|
this.outputMessageTabControl.Name = "testResultTab"; |
||||||
|
this.outputMessageTabControl.SelectedIndex = 0; |
||||||
|
this.outputMessageTabControl.Size = new System.Drawing.Size(417, 100); |
||||||
|
this.outputMessageTabControl.TabIndex = 7; |
||||||
|
//
|
||||||
|
// tabPage1
|
||||||
|
//
|
||||||
|
this.connectionStringTab.Controls.Add(this.connStringResult); |
||||||
|
this.connectionStringTab.Location = new System.Drawing.Point(4, 22); |
||||||
|
this.connectionStringTab.Name = "tabPage1"; |
||||||
|
this.connectionStringTab.Padding = new System.Windows.Forms.Padding(3); |
||||||
|
this.connectionStringTab.Size = new System.Drawing.Size(409, 74); |
||||||
|
this.connectionStringTab.TabIndex = 0; |
||||||
|
this.connectionStringTab.Text = "Connection String"; |
||||||
|
this.connectionStringTab.UseVisualStyleBackColor = true; |
||||||
|
//
|
||||||
|
// tabPage2
|
||||||
|
//
|
||||||
|
this.testResultTab.Controls.Add(this.testResultTextBox); |
||||||
|
this.testResultTab.Location = new System.Drawing.Point(4, 22); |
||||||
|
this.testResultTab.Name = "tabPage2"; |
||||||
|
this.testResultTab.Padding = new System.Windows.Forms.Padding(3); |
||||||
|
this.testResultTab.Size = new System.Drawing.Size(409, 74); |
||||||
|
this.testResultTab.TabIndex = 1; |
||||||
|
this.testResultTab.Text = "Test Result Message"; |
||||||
|
this.testResultTab.UseVisualStyleBackColor = true; |
||||||
|
//
|
||||||
|
// testResultTextBox
|
||||||
|
//
|
||||||
|
this.testResultTextBox.Location = new System.Drawing.Point(-5, 0); |
||||||
|
this.testResultTextBox.Multiline = true; |
||||||
|
this.testResultTextBox.Name = "testResultTextBox"; |
||||||
|
this.testResultTextBox.Size = new System.Drawing.Size(418, 77); |
||||||
|
this.testResultTextBox.TabIndex = 0; |
||||||
|
//
|
||||||
|
// ConnectionStringDefinitionDialog
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||||
|
this.ClientSize = new System.Drawing.Size(547, 500); |
||||||
|
this.Controls.Add(this.outputMessageTabControl); |
||||||
|
this.Controls.Add(this.statusStrip); |
||||||
|
this.Controls.Add(this.connectionStringLabel); |
||||||
|
this.Controls.Add(this.dataSourceTypeLabel); |
||||||
|
this.Controls.Add(this.providerTypeComboBox); |
||||||
|
this.Controls.Add(this.buttonsFlowLayoutPanel); |
||||||
|
this.Controls.Add(this.connStringPropertyGrid); |
||||||
|
this.Name = "ConnectionStringDefinitionDialog"; |
||||||
|
this.Text = "Set up Connection String"; |
||||||
|
this.buttonsFlowLayoutPanel.ResumeLayout(false); |
||||||
|
this.outputMessageTabControl.ResumeLayout(false); |
||||||
|
this.connectionStringTab.ResumeLayout(false); |
||||||
|
this.connectionStringTab.PerformLayout(); |
||||||
|
this.testResultTab.ResumeLayout(false); |
||||||
|
this.testResultTab.PerformLayout(); |
||||||
|
this.ResumeLayout(false); |
||||||
|
this.PerformLayout(); |
||||||
|
} |
||||||
|
private System.Windows.Forms.TabControl outputMessageTabControl; |
||||||
|
private System.Windows.Forms.TextBox testResultTextBox; |
||||||
|
private System.Windows.Forms.TabPage testResultTab; |
||||||
|
private System.Windows.Forms.TabPage connectionStringTab; |
||||||
|
|
||||||
|
private System.Windows.Forms.Timer progressTimer; |
||||||
|
private System.Windows.Forms.StatusStrip statusStrip; |
||||||
|
private System.Windows.Forms.TextBox connStringResult; |
||||||
|
private System.Windows.Forms.Label connectionStringLabel; |
||||||
|
private System.Windows.Forms.Label dataSourceTypeLabel; |
||||||
|
private System.Windows.Forms.ComboBox providerTypeComboBox; |
||||||
|
private System.Windows.Forms.Button cancelButton; |
||||||
|
private System.Windows.Forms.Button submitButton; |
||||||
|
private System.Windows.Forms.Button testButton; |
||||||
|
private System.Windows.Forms.FlowLayoutPanel buttonsFlowLayoutPanel; |
||||||
|
private System.Windows.Forms.PropertyGrid connStringPropertyGrid; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,216 @@ |
|||||||
|
|
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
using System.Windows.Forms; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Data.Common; |
||||||
|
using System.ComponentModel; |
||||||
|
|
||||||
|
namespace SharpDbTools.Connection |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// This class creates a dialog that can be used to create and test connection strings
|
||||||
|
/// that can be used with .net 2.0 DbProviders.
|
||||||
|
/// It utilises .net 2.0 configuration to discover any DbProviderFactories that are
|
||||||
|
/// installed and configured in machine.config, app.config or user.config using
|
||||||
|
/// standard .net 2.0 apis.
|
||||||
|
/// It then enables a user to browse the properties of each type of db connection,
|
||||||
|
/// set values for them and test the resulting connection string.
|
||||||
|
/// When the submit button is clicked the dialog is dismissed and the connection
|
||||||
|
/// string constructed is accessible through the ConnectionString property of the dialog.
|
||||||
|
/// </summary>
|
||||||
|
public partial class ConnectionStringDefinitionDialog |
||||||
|
{ |
||||||
|
ToolStripProgressBar connectionTestProgressBar = new ToolStripProgressBar(); |
||||||
|
ConnectionTestBackgroundWorker testConnectionBackgroundWorker; |
||||||
|
string resultMessage; |
||||||
|
|
||||||
|
public ConnectionStringDefinitionDialog() |
||||||
|
{ |
||||||
|
//
|
||||||
|
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||||
|
//
|
||||||
|
InitializeComponent(); |
||||||
|
this.connStringPropertyGrid.PropertyValueChanged += |
||||||
|
new PropertyValueChangedEventHandler(this.ConnStringAttributesViewPropertyValueChanged); |
||||||
|
// add a ProgressBar to the statusString
|
||||||
|
this.statusStrip.Items.Add(connectionTestProgressBar); |
||||||
|
this.connectionTestProgressBar.Step = 10; |
||||||
|
this.connectionTestProgressBar.Minimum = 0; |
||||||
|
this.connectionTestProgressBar.Maximum = 150; |
||||||
|
} |
||||||
|
|
||||||
|
public string ResultMessage |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return resultMessage; |
||||||
|
} |
||||||
|
set |
||||||
|
{ |
||||||
|
resultMessage = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DbConnectionStringBuilder ConnectionStringBuilder |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return (DbConnectionStringBuilder)this.connStringPropertyGrid.SelectedObject; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string ConnectionString |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return ((DbConnectionStringBuilder)this.connStringPropertyGrid.SelectedObject).ConnectionString; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnLoad(EventArgs e) |
||||||
|
{ |
||||||
|
//
|
||||||
|
// set the PropertyGrid to browse the available DbProviders
|
||||||
|
//
|
||||||
|
|
||||||
|
base.OnLoad(e); |
||||||
|
|
||||||
|
DbProvidersService service = DbProvidersService.GetDbProvidersService(); |
||||||
|
List<string> names = service.Names; |
||||||
|
this.providerTypeComboBox.DataSource = names; |
||||||
|
this.connStringResult.Text = this.ConnectionString; |
||||||
|
} |
||||||
|
|
||||||
|
void CancelButtonClick(object sender, System.EventArgs e) |
||||||
|
{ |
||||||
|
this.Close(); |
||||||
|
} |
||||||
|
|
||||||
|
void ProviderTypeSelectedIndexChanged(object sender, System.EventArgs e) |
||||||
|
{ |
||||||
|
string selection = (string)this.providerTypeComboBox.SelectedItem; |
||||||
|
DbProvidersService service = DbProvidersService.GetDbProvidersService(); |
||||||
|
DbProviderFactory factory = service[selection]; |
||||||
|
DbConnectionStringBuilder builder = factory.CreateConnectionStringBuilder(); |
||||||
|
connStringPropertyGrid.SelectedObject = builder; |
||||||
|
} |
||||||
|
|
||||||
|
void ConnStringAttributesViewPropertyValueChanged(Object s, PropertyValueChangedEventArgs args) |
||||||
|
{ |
||||||
|
// looking for changes to the ConnectionString property in the PropertyGrid
|
||||||
|
this.connStringResult.Text = this.ConnectionString; |
||||||
|
this.outputMessageTabControl.SelectTab(this.connectionStringTab); |
||||||
|
ResetTestResultTextBox(); |
||||||
|
} |
||||||
|
|
||||||
|
void TestButtonClick(object sender, System.EventArgs e) |
||||||
|
{ |
||||||
|
string dbTypeName = (string)this.providerTypeComboBox.SelectedItem; |
||||||
|
testConnectionBackgroundWorker = new ConnectionTestBackgroundWorker(dbTypeName); |
||||||
|
testConnectionBackgroundWorker.WorkerSupportsCancellation = false; |
||||||
|
progressTimer.Enabled = true; |
||||||
|
testConnectionBackgroundWorker.DoWork += |
||||||
|
new DoWorkEventHandler(this.TestConnectionBackgroundWorkerDoWork); |
||||||
|
testConnectionBackgroundWorker.RunWorkerCompleted += |
||||||
|
new RunWorkerCompletedEventHandler(TestConnectionRunWorkerComplete); |
||||||
|
testConnectionBackgroundWorker.RunWorkerAsync(); |
||||||
|
} |
||||||
|
|
||||||
|
void ProgressTimerTick(object sender, System.EventArgs e) |
||||||
|
{ |
||||||
|
this.Invoke(new EventHandler(UpdateProgressBar)); |
||||||
|
} |
||||||
|
|
||||||
|
void UpdateProgressBar(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
ToolStripProgressBar p = connectionTestProgressBar; |
||||||
|
if (p.Value == p.Maximum) p.Value = 0; |
||||||
|
p.PerformStep(); |
||||||
|
} |
||||||
|
|
||||||
|
void SetTestResultTextBox() |
||||||
|
{ |
||||||
|
this.testResultTextBox.Text = ResultMessage; |
||||||
|
this.outputMessageTabControl.SelectTab(this.testResultTab); |
||||||
|
} |
||||||
|
|
||||||
|
void ResetTestResultTextBox() |
||||||
|
{ |
||||||
|
this.testResultTextBox.Text = ""; |
||||||
|
} |
||||||
|
|
||||||
|
void TestConnectionBackgroundWorkerDoWork(object sender, DoWorkEventArgs e) |
||||||
|
{ |
||||||
|
DbConnection connection = null; |
||||||
|
try |
||||||
|
{ |
||||||
|
// get the current name
|
||||||
|
|
||||||
|
ConnectionTestBackgroundWorker bw = sender as ConnectionTestBackgroundWorker; |
||||||
|
string currentDbTypeName = bw.DatabaseType; |
||||||
|
|
||||||
|
// get the DbProviderFactory for this name
|
||||||
|
|
||||||
|
DbProvidersService service = DbProvidersService.GetDbProvidersService(); |
||||||
|
DbProviderFactory factory = service[currentDbTypeName]; |
||||||
|
|
||||||
|
// get a connection object or this factory
|
||||||
|
|
||||||
|
connection = factory.CreateConnection(); |
||||||
|
connection.ConnectionString = this.ConnectionString; |
||||||
|
|
||||||
|
connection.Open(); |
||||||
|
e.Result = "Connection Succeeded"; |
||||||
|
} |
||||||
|
catch(Exception ex) |
||||||
|
{ |
||||||
|
e.Result = "Connection Failed: " + ex.Message; |
||||||
|
} |
||||||
|
finally |
||||||
|
{ |
||||||
|
if (connection != null) |
||||||
|
{ |
||||||
|
connection.Close(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void TestConnectionRunWorkerComplete(object sender, RunWorkerCompletedEventArgs args) |
||||||
|
{ |
||||||
|
ResultMessage = args.Result as string; |
||||||
|
this.Invoke(new EventHandler(TestConnectionCompleted)); |
||||||
|
} |
||||||
|
|
||||||
|
void TestConnectionCompleted(object sender, EventArgs args) |
||||||
|
{ |
||||||
|
progressTimer.Enabled = false; |
||||||
|
connectionTestProgressBar.Value = 0; |
||||||
|
SetTestResultTextBox(); |
||||||
|
testConnectionBackgroundWorker.Dispose(); |
||||||
|
} |
||||||
|
|
||||||
|
void SubmitButtonClick(object sender, System.EventArgs e) |
||||||
|
{ |
||||||
|
this.Close(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class ConnectionTestBackgroundWorker: BackgroundWorker |
||||||
|
{ |
||||||
|
private string dbTypeName; |
||||||
|
|
||||||
|
public ConnectionTestBackgroundWorker(string dbTypeName): base() |
||||||
|
{ |
||||||
|
this.dbTypeName = dbTypeName; |
||||||
|
} |
||||||
|
|
||||||
|
public string DatabaseType |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return dbTypeName; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,126 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<root> |
||||||
|
<!-- |
||||||
|
Microsoft ResX Schema |
||||||
|
|
||||||
|
Version 2.0 |
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format |
||||||
|
that is mostly human readable. The generation and parsing of the |
||||||
|
various data types are done through the TypeConverter classes |
||||||
|
associated with the data types. |
||||||
|
|
||||||
|
Example: |
||||||
|
|
||||||
|
... ado.net/XML headers & schema ... |
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||||
|
<resheader name="version">2.0</resheader> |
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||||
|
</data> |
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||||
|
<comment>This is a comment</comment> |
||||||
|
</data> |
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple |
||||||
|
name/value pairs. |
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a |
||||||
|
type or mimetype. Type corresponds to a .NET class that support |
||||||
|
text/value conversion through the TypeConverter architecture. |
||||||
|
Classes that don't support this are serialized and stored with the |
||||||
|
mimetype set. |
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the |
||||||
|
ResXResourceReader how to depersist the object. This is currently not |
||||||
|
extensible. For a given mimetype the value must be set accordingly: |
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||||
|
that the ResXResourceWriter will generate, however the reader can |
||||||
|
read any of the formats listed below. |
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64 |
||||||
|
value : The object must be serialized with |
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
||||||
|
: and then encoded with base64 encoding. |
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64 |
||||||
|
value : The object must be serialized with |
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||||
|
: and then encoded with base64 encoding. |
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||||
|
value : The object must be serialized into a byte array |
||||||
|
: using a System.ComponentModel.TypeConverter |
||||||
|
: and then encoded with base64 encoding. |
||||||
|
--> |
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
||||||
|
<xsd:element name="root" msdata:IsDataSet="true"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:choice maxOccurs="unbounded"> |
||||||
|
<xsd:element name="metadata"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:sequence> |
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||||
|
</xsd:sequence> |
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" /> |
||||||
|
<xsd:attribute name="type" type="xsd:string" /> |
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||||
|
<xsd:attribute ref="xml:space" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
<xsd:element name="assembly"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:attribute name="alias" type="xsd:string" /> |
||||||
|
<xsd:attribute name="name" type="xsd:string" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
<xsd:element name="data"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:sequence> |
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||||
|
</xsd:sequence> |
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||||
|
<xsd:attribute ref="xml:space" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
<xsd:element name="resheader"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:sequence> |
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||||
|
</xsd:sequence> |
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
</xsd:choice> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
</xsd:schema> |
||||||
|
<resheader name="resmimetype"> |
||||||
|
<value>text/microsoft-resx</value> |
||||||
|
</resheader> |
||||||
|
<resheader name="version"> |
||||||
|
<value>2.0</value> |
||||||
|
</resheader> |
||||||
|
<resheader name="reader"> |
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||||
|
</resheader> |
||||||
|
<resheader name="writer"> |
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||||
|
</resheader> |
||||||
|
<metadata name="progressTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||||
|
<value>247, 17</value> |
||||||
|
</metadata> |
||||||
|
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||||
|
<value>371, 17</value> |
||||||
|
</metadata> |
||||||
|
</root> |
@ -0,0 +1,93 @@ |
|||||||
|
/* |
||||||
|
* Responsibilities:<br> |
||||||
|
* <br> |
||||||
|
* Collaboration:<br> |
||||||
|
* <br> |
||||||
|
* User: Dickon Field |
||||||
|
* Date: 21/05/2006 |
||||||
|
* Time: 23:19 |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Data.Common; |
||||||
|
using System.Data; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
namespace SharpDbTools.Connection |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// A utility class that caches the DbProviderFactory and DbConnectionString
|
||||||
|
/// objects whose state is stored in the current processes config space.
|
||||||
|
/// </summary>
|
||||||
|
public class DbProvidersService |
||||||
|
{ |
||||||
|
private static DbProvidersService me = new DbProvidersService(); |
||||||
|
private static Boolean initialized = false; |
||||||
|
private Dictionary<string, DbProviderFactory> factories = new Dictionary<string, DbProviderFactory>(); |
||||||
|
private List<string> names = new List<string>(); |
||||||
|
|
||||||
|
private DbProvidersService() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
private void Initialize() |
||||||
|
{ |
||||||
|
// get a complete list of config data for DbProviderFactories, indexed by name
|
||||||
|
|
||||||
|
DataTable providerFactoriesTable = DbProviderFactories.GetFactoryClasses(); |
||||||
|
DataRow[] rows = providerFactoriesTable.Select(); |
||||||
|
|
||||||
|
foreach(DataRow row in rows) |
||||||
|
{ |
||||||
|
string name = (string)row["Name"]; |
||||||
|
//factoryData.Add(name, row);
|
||||||
|
DbProviderFactory factory = DbProviderFactories.GetFactory(row); |
||||||
|
names.Add(name); |
||||||
|
factories.Add(name, factory); |
||||||
|
} |
||||||
|
|
||||||
|
initialized = true; |
||||||
|
} |
||||||
|
|
||||||
|
public List<string> Names |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return names; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string this[int i] |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return names[i]; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DbProviderFactory this[string name] |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return factories[name]; |
||||||
|
} |
||||||
|
set |
||||||
|
{ |
||||||
|
factories[name] = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static DbProvidersService GetDbProvidersService() |
||||||
|
{ |
||||||
|
lock(me) |
||||||
|
{ |
||||||
|
if (!initialized) |
||||||
|
{ |
||||||
|
me.Initialize(); |
||||||
|
} |
||||||
|
} |
||||||
|
return me; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,112 @@ |
|||||||
|
/* |
||||||
|
* User: Dickon Field |
||||||
|
* Date: 05/07/2006 |
||||||
|
* Time: 22:13 |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Data; |
||||||
|
using System.Data.Common; |
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
|
||||||
|
namespace SharpDbTools.Model |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of ConnectionInfo.
|
||||||
|
/// </summary>
|
||||||
|
public class DbConnectionInfo: IConnectionInfo, IDisposable |
||||||
|
{ |
||||||
|
DbConnection connection = null; |
||||||
|
string connectionString = null; |
||||||
|
string invariantName = null; |
||||||
|
string name = null; |
||||||
|
DbModelInfo dbModel = null; |
||||||
|
|
||||||
|
private DbConnectionInfo() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public DbConnectionInfo(string name, string invariantName, string connectionString) |
||||||
|
{ |
||||||
|
this.name = name; |
||||||
|
this.connectionString = connectionString; |
||||||
|
this.invariantName = invariantName; |
||||||
|
} |
||||||
|
|
||||||
|
public bool HasConnection |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return !(connection == null); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool HasModel |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return !(dbModel == null); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DbConnection Connection |
||||||
|
{ |
||||||
|
get { |
||||||
|
// return connection if defined else try and create it
|
||||||
|
if (connection != null) { |
||||||
|
return connection; |
||||||
|
} |
||||||
|
else { |
||||||
|
DbProviderFactory factory = DbProviderFactories.GetFactory(invariantName); |
||||||
|
this.connection = factory.CreateConnection(); |
||||||
|
this.connection.ConnectionString = this.connectionString; |
||||||
|
this.connection.Open(); |
||||||
|
return this.connection; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DataSet DbModel |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if (dbModel == null) |
||||||
|
{ |
||||||
|
dbModel = new DbModelInfo(); |
||||||
|
DbConnection connection = this.Connection; |
||||||
|
|
||||||
|
// get the Schema table
|
||||||
|
|
||||||
|
DataTable schemaInfo = connection.GetSchema(); |
||||||
|
|
||||||
|
// iterate through the rows in it - the first column of each is a
|
||||||
|
// schema info collection name that can be retrieved as a DbTable
|
||||||
|
// Add each one to the DbModel DataSet
|
||||||
|
|
||||||
|
foreach (DataRow collectionRow in schemaInfo.Rows) { |
||||||
|
String collectionName = (string)collectionRow[0]; |
||||||
|
DataTable nextMetaData = connection.GetSchema(collectionName); |
||||||
|
dbModel.Merge(nextMetaData); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
return this.dbModel; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void Dispose() |
||||||
|
{ |
||||||
|
try { |
||||||
|
this.connection.Close(); |
||||||
|
} |
||||||
|
catch(Exception e) { |
||||||
|
LoggingService.Warn("unable to close connection: exception thrown", e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// TODO: serialise into a store
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
/* |
||||||
|
* User: Dickon Field |
||||||
|
* Date: 10/07/2006 |
||||||
|
* Time: 09:12 |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Data; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
namespace SharpDbTools.Model |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// DbModel is a DataSet containing the metadata tables returned from a DbConnection.
|
||||||
|
/// It adds methods designed specifically to facilitate access to the data in the
|
||||||
|
/// DataTables contained by the DbModel.
|
||||||
|
///
|
||||||
|
/// The DbModel class is intended to be usable in a fully disconnected mode - that is,
|
||||||
|
/// it requires a DbConnection to populate it, but it may then be locally persisted and subsequently
|
||||||
|
/// retrieved from its persisted data. This is intended to allow work to progress against the
|
||||||
|
/// DbModel without requiring a connection to its RDB server.
|
||||||
|
/// </summary>
|
||||||
|
public class DbModelInfo: DataSet |
||||||
|
{ |
||||||
|
public const string METADATACOLLECTIONS = "MetaDataCollections"; |
||||||
|
|
||||||
|
public DbModelInfo() |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
/* |
||||||
|
* User: Dickon Field |
||||||
|
* Date: 10/07/2006 |
||||||
|
* Time: 09:23 |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace SharpDbTools.Model |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Presents the basic contract for ConnectionInfo classes
|
||||||
|
/// </summary>
|
||||||
|
public interface IConnectionInfo |
||||||
|
{ |
||||||
|
bool HasConnection |
||||||
|
{ |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
bool HasModel |
||||||
|
{ |
||||||
|
get; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
/* |
||||||
|
* User: Dickon Field |
||||||
|
* Date: 12/06/2006 |
||||||
|
* Time: 06:25 |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
|
||||||
|
namespace SharpDbTools |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Enables a user to browse metadata associated with a db server and to open resources
|
||||||
|
/// referenced therein.
|
||||||
|
/// </summary>
|
||||||
|
public class ServerBrowserTool : AbstractPadContent |
||||||
|
{ |
||||||
|
Panel ctl; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public ServerBrowserTool() |
||||||
|
{ |
||||||
|
ctl = new Panel(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
|
||||||
|
/// </summary>
|
||||||
|
public override Control Control { |
||||||
|
get { |
||||||
|
return ctl; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refreshes the pad
|
||||||
|
/// </summary>
|
||||||
|
public override void RedrawContent() |
||||||
|
{ |
||||||
|
// TODO: Refresh the whole pad control here, renew all resource strings whatever
|
||||||
|
// Note that you do not need to recreate the control.
|
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cleans up all used resources
|
||||||
|
/// </summary>
|
||||||
|
public override void Dispose() |
||||||
|
{ |
||||||
|
ctl.Dispose(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue