This project is read-only.

OleDBDatabaseMigrator

OleDBDatabaseMigrator is a class that lets you generate a Db4o object database from a RDBMS database.

This class is in the namespace UsefulDB4O.OleDBMigration.

 

How does that?

In summary, just 2 steps:

  1. First we generate the model (class, attributes, etc.) with the T4 Templates included in the project (inside T4_OledbToOO_Templates folder)
  2. OleDBDatabaseMigrator class will analyze the generated model (with help of attributes) and will create a Db4o database file with all the data.

 

Step 1. Generating the model

First, if you do not know anything about T4 Templates the best place to start is this post made by Oleg Sych (Oleg is the “oracle” in this world!).

Keep in mind that you need install T4Toolbox free VS 2008 Addin to works with our templates.

Our T4 Templates read metadata information from RDBMS database and try to pass to the OOP world like others ORM tools make.

We use the Oledb metadata information to map the entities and features from RDBMS database.

In this moment, we support migrate this elements or features from Oledb metadata:

  1. Tables
  2. Columns
  3. Unique keys
  4. Indexes
  5. Column restrictions (using Data Annotations)
  6. Relations (1-1, 1-Many)

 

Watch this video tutorial to more info (change to full screen mode):

 

The model generation is highly customizable, but it will see in later chapters.

 

Step 2. Generating the Db4o database

After we have the assembly with our model (class, properties, attributes, etc.) we just need configure the OleDBDatabaseMigrator instance to generate Db4o database file.

 

Watch this video tutorial to more info (change to full screen mode):

 

The OleDBDatabaseMigrator class is highly customizable, but it will see in later chapters.

 

Supported RDBMS databases

We made tests against: Sql Server 2000, Sql Server 2005, Sql Server 2008.

All code examples use the AdventureWorks model from Microsoft.

 

In theory you can use “any” database. All you need is to have the correct Oledb provider and set your database connection properly.

Examples from www.connectionstrings.com:

  1. SQL Server Native Client 10.0 OLE DB Provider
    1. Provider=SQLNCLI10;Server=myServerAddress;Database=myDataBase; Trusted_Connection=yes;
  2. Oracle Provider for OLE DB
    1. Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;
  3. MySql .NET Framework Data Provider for OLE DB
    1. Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;

 

Last edited Sep 2, 2010 at 8:21 AM by pacoweb, version 9

Comments

No comments yet.