dotnetpowered.com - Brian Ritchie's .NET Development Site   [ Home ]

SharpDbSchema 0.2

Overview

ADO.NET is missing an extensible architecture for accessing database schema information.  While there are ways to get this information using the OLE provider, or importing the old ADO COM libraries, there doesn't seem to be a pure managed code method.

Hopefully, the SharpDBSchema library changes this.  It is designed using a provider pattern which will allow each database provider to implement a method for collecting schema information. 

Any feedback would be appreciated.

Download

The Source package now includes a web-based schema browser.

[ View Source Online | Download Source & Binaries | Download Binaries Only ]

Online Demos

Want to see it in action? 

  • Try the Schema Browser included in the Source & Binaries download 
  • The DevCenter uses the SharpRepositoryLib to browse source repositories through a web page.

Release History

  • 0.2
    • Added MySQL schema provider
      Requires ByteFX MySql Provider (.NET 1.1), download seperately. You can get it compiled for .NET 1.0 here
    • Added web-based schema browser
    • Fixed connection bug in SQL Server provider
  • 0.1
    • Schema Interfaces
    • Factory-based provider creation using configuration file
    • MS SQL Server provider

Sample web.config or app.config file:

 <configSections>
    <section name="DbSchema" type="SharpDbSchema.DbSchemaSectionHandler,SharpDbSchema.Core" />
 </configSections>
 
 <DbSchema>
    <SchemaProvider Name="SqlServer" Type="SharpDbSchema.SqlServer.SqlServerSchemaProvider, SharpDbSchema.SqlServer"/>  
    <SchemaProvider Name="MySql" Type="SharpDbSchema.MySql.MySqlSchemaProvider, SharpDbSchema.MySql"/>  
 </DbSchema>
 

Sample Code:

 
 ISchemaProvider provider=DbSchemaFactory.Create("SqlServer");
 IDatabaseInfo db=provider.GetDatabase("Northwind","server=test;database=northwind;uid=sa"); 
 foreach (ITableInfo tableinfo in db.Tables)
 {
	 foreach (IColumnInfo colinfo in tableinfo.Columns)
 	 {

 	 }
 }