diff --git a/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/Config/AssemblyInfo.cs b/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/Config/AssemblyInfo.cs
new file mode 100644
index 0000000000..dc099a5812
--- /dev/null
+++ b/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/Config/AssemblyInfo.cs
@@ -0,0 +1,31 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("SQLServerDbToolsProvider")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SQLServerDbToolsProvider")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// This sets the default COM visibility of types in the assembly to invisible.
+// If you need to expose a type to COM, use [ComVisible(true)] on that type.
+[assembly: ComVisible(false)]
+
+// 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.*")]
diff --git a/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/SQLServerDbToolsProvider.csproj b/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/SQLServerDbToolsProvider.csproj
new file mode 100644
index 0000000000..269a18554f
--- /dev/null
+++ b/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/SQLServerDbToolsProvider.csproj
@@ -0,0 +1,61 @@
+
+
+ Library
+ SQLServerDbToolsProvider
+ SQLServerDbToolsProvider
+ Debug
+ AnyCPU
+ {8C692BAF-108E-4346-B41E-6EE7D20E2E9D}
+ False
+ False
+ 4
+ false
+
+
+ ..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\
+ False
+ DEBUG;TRACE
+ true
+ Full
+ True
+
+
+ bin\Release\
+ True
+ TRACE
+ False
+ None
+ False
+
+
+ False
+ Auto
+ 4194304
+ AnyCPU
+ 4096
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}
+ ICSharpCode.Core
+
+
+ {93B2D6DF-7588-40C0-8A35-CA0DD7328FC3}
+ SharpDbTools
+
+
+
+
\ No newline at end of file
diff --git a/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/SQLServerDbToolsProvider.sln b/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/SQLServerDbToolsProvider.sln
new file mode 100644
index 0000000000..fe9cb573fc
--- /dev/null
+++ b/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/SQLServerDbToolsProvider.sln
@@ -0,0 +1,7 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# SharpDevelop 2.1.0.2001
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLServerDbToolsProvider", "SQLServerDbToolsProvider.csproj", "{8C692BAF-108E-4346-B41E-6EE7D20E2E9D}"
+EndProject
+Global
+EndGlobal
diff --git a/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/Src/Forms/SQLServerFormsArtefactFactory.cs b/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/Src/Forms/SQLServerFormsArtefactFactory.cs
new file mode 100644
index 0000000000..abc97f2aa3
--- /dev/null
+++ b/src/AddIns/Misc/SharpServerTools/SQLServerDbToolsProvider/Src/Forms/SQLServerFormsArtefactFactory.cs
@@ -0,0 +1,115 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using System;
+using System.Data;
+using System.Windows.Forms;
+
+using ICSharpCode.Core;
+using SharpDbTools.Data;
+using SharpDbTools.Forms;
+
+namespace SharpDbTools.SQLServer.Forms
+{
+ ///
+ /// Description of MetaDataNodeBuilder.
+ /// TODO: currently this is just a flat list - need to reflect ownership
+ /// relationships such as schema etc
+ ///
+ public class SQLServerFormsArtefactFactory : FormsArtefactFactory
+ {
+ public SQLServerFormsArtefactFactory()
+ {
+ }
+
+ public override TreeNode CreateMetaDataNode(string logicalConnectionName)
+ {
+ LoggingService.Debug(this.GetType().ToString()
+ + ": creating MetaDataNode for: " + logicalConnectionName);
+ // create root node of the metadata collections tree
+
+ TreeNode metaNode = new TreeNode("Db Objects");
+
+ // retrieve the metadata for this logical connection name
+
+ DbModelInfo info = DbModelInfoService.GetDbModelInfo(logicalConnectionName);
+
+ // retrieve the table listing the metadata collections
+
+ DataTable metadataCollectionsTable = info.Tables[TableNames.MetaDataCollections];
+
+ // if it exists then populate the tree
+
+ if (metadataCollectionsTable != null) {
+ LoggingService.Debug(this.GetType().ToString() + ": found metadata collections table, " +
+ " building node...");
+ for (int i = 0; i < TableNames.PrimaryObjects.Length; i++) {
+ string metadataCollectionName = TableNames.PrimaryObjects[i];
+ LoggingService.Debug("looking for metadata: " + metadataCollectionName);
+ DataTable metaCollectionTable = info.Tables[metadataCollectionName];
+ LoggingService.Debug("found metadata collection: " + metadataCollectionName);
+ TreeNode collectionNode = new TreeNode(metadataCollectionName);
+ metaNode.Nodes.Add(collectionNode);
+
+ if (metaCollectionTable != null) {
+ foreach (DataRow dbObjectRow in metaCollectionTable.Rows) {
+ TreeNode objectNode = null;
+
+ // if there is only one field in the metadata table then it is almost certainly
+ // the name of the item - so if not we need to then figure out what it is
+ if (dbObjectRow.ItemArray.Length > 1) {
+
+ // if it is a table metadata collection then create a node
+ // with the option to invoke the DescribeTableViewContent -
+ // that's what a TableTreeNode gives us right now
+ // TODO: provide describe functions amongst others for
+ // other metadata types
+
+ switch (metadataCollectionName) {
+ case "Tables":
+ objectNode = new TableTreeNode((string)dbObjectRow[2], logicalConnectionName);
+ break;
+ case "Functions":
+ // do nothing - there are no functions in SQLServer
+ break;
+ case "Users":
+ objectNode = new TreeNode((string)dbObjectRow[1]);
+ break;
+ default:
+ objectNode = new TreeNode((string)dbObjectRow[2]);
+ break;
+ }
+ } else {
+ objectNode = new TreeNode((string)dbObjectRow[0]);
+ }
+ collectionNode.Nodes.Add(objectNode);
+ }
+ }
+ }
+ }
+ return metaNode;
+ }
+
+ public override string[] GetDescribeTableFieldNames()
+ {
+ return tableFieldsToDisplay;
+ }
+ public override string[] GetDescribeTableColumnHeaderNames()
+ {
+ return tableFieldsColumnHeaders;
+ }
+
+ private static string[] tableFieldsToDisplay =
+ new string [] {"COLUMN_NAME", "DATA_TYPE",
+ "CHARACTER_OCTET_LENGTH", "NUMERIC_PRECISION", "NUMERIC_SCALE", "IS_NULLABLE"};
+ private static string[] tableFieldsColumnHeaders =
+ new string[] { "Column", "Type", "Length", "Precision", "Scale", "Nullable" };
+
+
+ }
+
+}
diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin
index 5cfc2d8b12..0f912f002d 100644
--- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin
+++ b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin
@@ -11,6 +11,7 @@
+
@@ -27,6 +28,11 @@
class = "SharpDbTools.Oracle.Forms.OracleFormsArtefactFactory"/>
+
+
+
+
diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Data/DbModelInfoService.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Data/DbModelInfoService.cs
index 2200359eee..bcf5895e0b 100644
--- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Data/DbModelInfoService.cs
+++ b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Data/DbModelInfoService.cs
@@ -130,6 +130,9 @@ namespace SharpDbTools.Data
connection.Open();
DataTable schemaInfo = connection.GetSchema();
+ if (schemaInfo != null) {
+ LoggingService.Debug("retrieved schema info with " + schemaInfo.Rows.Count + " rows");
+ }
// clear the DbModelInfo prior to refreshing from the connection
modelInfo.ClearMetaData();
@@ -140,9 +143,12 @@ namespace SharpDbTools.Data
foreach (DataRow collectionRow in schemaInfo.Rows) {
String collectionName = (string)collectionRow[0];
+ LoggingService.Debug("loading metadata for collection: " + collectionName);
DataTable nextMetaData = connection.GetSchema(collectionName);
modelInfo.Merge(nextMetaData);
}
+ LoggingService.Debug("completed load of metadata, committing changes");
+ modelInfo.AcceptChanges();
return modelInfo;
}
catch(Exception e) {
diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs
index 8c5f8dfb8e..2ca6fe1bb6 100644
--- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs
+++ b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs
@@ -47,30 +47,6 @@ namespace SharpDbTools.Forms
+ invariantName);
}
return factory;
-
-// switch (invariantName)
-// {
-// case "System.Data.OracleClient":
-// Type type = Type.GetType("SharpDbTools.Oracle.Forms.OracleFormsArtefactFactory, OracleDbToolsProvider");
-// FormsArtefactFactory factory = (FormsArtefactFactory)Activator.CreateInstance(type);
-// LoggingService.Debug("Found FormsArtefactFactory for: " + invariantName);
-// return factory;
-// default:
-// LoggingService.Debug("Failed to find FormsArtefactFactory for: " + invariantName);
-// throw new ArgumentException("There is no FormsArtefactFactory for invariant name: " +
-// invariantName);
-// }
-
-
- // TODO: retrieve the relevant factory from file-base config
- // TODO: >>>>>>>>>>>>>>>>>>> NEXT: retrieve an XML element with mapping
- // from invariant name to class name of FormsArtefactProvider
- // options include specific config file or use of .net process config.
-
- // 1. load the config file for DbTools FormsArtefacts
- // 2. find the string name of the type of the FormsArtefactsFactory implementation
- // corresponding to invariatName
- // 3. use Type.GetType to create an instance of it and return it to the caller
}
}
}