This project is read-only.
Database Schema Provider gets a database schema in unified format independent on the type of database.
It uses ADO.NET data provider for Entity Framework e.g.
The principle is following:
I build Entity Framework database schema model dynamically. The conceptual schema of this model is defined by Microsoft and I get it here
I get the Store and the Mapping schema from a ADO.NET data provider manifest

I don’t use DbConnection.GetSchema method because the result is depend on the type of database and I was looking for a solution independent on a physical database.

      string connStr, dataProvider = null;
      // Sample How to read DB schema
      // !!!!!!!!!! Modify connection string for Microsoft SQL Database Nortwind
      dataProvider = "System.Data.SqlClient";
      connStr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=l:\test\northwnd.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";

      var dbp = new ma.DbSchemaProvider.DbSchemaProvider(dataProvider, connStr);
      var tabDef = dbp.GetTable("Products");
      var colDef = dbp.GetColumns("Products");
      var keyDef = dbp.GetPrimaryKeys("Products");

      // !!!!!!!!!! Modify connection string for Oracle DB
      dataProvider = "Devart.Data.Oracle";
      connStr = @"User Id=HR; Password=hr; Data Source=";
      dbp = new ma.DbSchemaProvider.DbSchemaProvider(dataProvider, connStr);
      tabDef = dbp.GetTable("JOBS");
      colDef = dbp.GetColumns("JOBS");
      keyDef = dbp.GetPrimaryKeys("JOBS");

Last edited Dec 13, 2010 at 9:42 AM by MirekM, version 3