Vagif Abilov's blog on .NET

October 2010 - Posts

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!

Test post to check syntax highlighter

This post has been written using Windows Live Writer 2011 with FiftyEightBits PreCode Snippet. This is C# code sample:

public void Test()
{
    Console.WriteLine("Hello");
}

And this is F# code:

let rec search m x y f accu = match x, y with
  | x, y when x = size2 -> search m 0 (y + 1) f accu
  | 0, y when y = size2 -> f accu
  | x, y when m.(y).(x) <> 0 -> search m (x + 1) y f accu
  | x, y ->
      let aux accu n =
        if invalid m 0 x y n then accu else begin
          m.(y).(x) <- n;
          let accu = search m (x + 1) y f accu in
          m.(y).(x) <- 0;
          accu
        end in
      fold aux accu 1 10

Well, actually I used C# brush for F# code. Hope that the server will be update with F# brush soon.

UPDATE. Dennis van der Stelt who is in charge for BloggingAbout.Net updated the server with new brushes, so I can now write as much F# code as I want. Thank you very much, Dennis!