Migrating database schema from Microsoft SQL Server to Oracle using Entity Framework and Devart dotConnect

This walkthrough covers the migration of tables and primary/foreign keys that is a reasonable assumption when accessing data using ORM.

Prerequisites

  • Visual Studio 2010 (should also work with Visual Studio 2008 with .NET 3.5 SP1 applied).
  • Devart dotConnect for Oracle (formely known as OraDirect.NET) that supports Entity Framework capabilities.

Steps to migrate data schema

1. Create a C# class library project using Visual Studio 2010.

Picture01

2. Delete a class created in a projects (“Class1”) and add a new item using “ADO.NET Entity Data Model” template.

Picture02

3. Select “Generate from database” and choose SQL Server database that contains the schema to be migrated.

Picture03

4. Select “Tables” in the next screen (“Choose Your Database Objects”), and Visual Studio will generate a model based on the selected database schema.

Picture04

Now if you right-click on a model diagram, Visual Studio will display a menu with an option “Generate Database from Model…”

Picture05

If you choose database generation, Entity Designer will generate a script for Microsoft SQL Server.

Picture06

4. Assuming Devart dotConnect is installed, it should be possible to change a template that is used to generate database script. Open “DDL Generation Template” combo box in Entity Designer Properties window and select “Devart SSDLToOracle.tt (VS)”.

Picture07

5. After the change of DDL generation template execute “Generate Database from Model” and you should get a script for Oracle data schema:

Picture08

Voila!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s