See Also

Project Members  | RedGate.SQLDataCompare.Engine Namespace

Requirements

Namespace: RedGate.SQLDataCompare.Engine

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: RedGate.SQLDataCompare.Engine (in RedGate.SQLDataCompare.Engine.dll)

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Requirements Languages RedGate.SQLDataCompare.Engine Send comments on this topic.

Project Class

RedGate.SQLDataCompare.Engine Namespace : Project Class (RedGate.SQLDataCompare.Engine)

A SQL Data Compare project.

For a list of all members of this type, see Project members.

Object Model




Inheritance Hierarchy

System.Object
   RedGate.SQLDataCompare.Engine.Project

Syntax

[Visual Basic]
Public Class Project    Implements IRedGateSerializable 
[C#]
public class Project : IRedGateSerializable 
[C++]
public __gc class Project : public IRedGateSerializable 
[C++/CLI]
public ref class Project : public IRedGateSerializable 

Remarks

This class provides an easy way to load and save comparison settings.

Example

Saving a project to, and loading from, disk

[C#] 

using System; 
using RedGate.SQLCompare.Engine; 
using RedGate.SQLDataCompare.Engine; 
using Project = RedGate.SQLDataCompare.Engine.Project; 
  
namespace SQLDataCompareCodeSnippets 

    /// <summary> 
    /// Summary description for ProjectExample. 
    /// </summary> 
    public class ProjectExample 
    { 
        public void RunExample() 
        { 
            Project project=new Project(); 
                  
            project.DataSource1.DatabaseName = "WidgetDev";             
            project.DataSource2.DatabaseName = "WidgetLive";             
            project.SessionSettings = SessionSettings.Default; 
            project.Options = new EngineDataCompareOptions(MappingOptions.Default,ComparisonOptions.Default, SqlOptions.Default); 
            Console.WriteLine("Saving project");             
            project.SaveToDisk(@"c:\testproject.sdc"); 
     
            //load up the project 
            Project project2=Project.LoadFromDisk(@"c:\testproject.sdc"); 
            Console.WriteLine("Project loaded"); 
     
            //get the two databases 
            Database db1= new Database(); 
            Database db2= new Database(); 
            SchemaMappings mappings = new SchemaMappings(); 
     
            //Should check if this is true 
            LiveDatabaseSource liveDb = project2.DataSource1 as LiveDatabaseSource; 
            db1.RegisterForDataCompare(liveDb.ToConnectionProperties()); 
  
            //Should check if this is true 
            liveDb = project2.DataSource2 as LiveDatabaseSource; 
            db2.RegisterForDataCompare(liveDb.ToConnectionProperties()); 
     
            mappings.Options = project2.Options; 
            mappings.CreateMappings(db1, db2); 
      
            //Disable any mappings here that you may want.... 
            ComparisonSession session=new ComparisonSession(); 
            session.Options = project2.Options; 
            session.CompareDatabases(db1, db2, mappings); 
     
            Console.WriteLine("Comparison run"); 
        } 
    } 

    

[Visual Basic] 

Option Explicit On

Imports RedGate.SQLCompare.Engine
Imports RedGate.SQLDataCompare.Engine
Imports Project = RedGate.SQLDataCompare.Engine.Project

Public Class ProjectExample
    Sub RunExample()
        Dim project As New Project

        project.DataSource1.DatabaseName = "WidgetDev"
        project.DataSource2.DatabaseName = "WidgetLive"
        project.SessionSettings = SessionSettings.Default
        project.Options = New EngineDataCompareOptions(MappingOptions.Default, ComparisonOptions.Default, SqlOptions.Default)
        Console.WriteLine("Saving project")
        project.SaveToDisk("c:\testproject.sdc")

        'load up the project
        Dim project2 As Project = project.LoadFromDisk("c:\testproject.sdc")
        Console.WriteLine("Project loaded")

        'get the two databases
        Dim db1 As New Database
        Dim db2 As New Database
        Dim mappings As New SchemaMappings

        'Should check if this is true
        Dim livedb As LiveDatabaseSource = DirectCast(project2.DataSource1, LiveDatabaseSource)
        db1.RegisterForDataCompare(livedb.ToConnectionProperties())

        'Should check if this is true
        livedb = DirectCast(project2.DataSource2, LiveDatabaseSource)
        db2.RegisterForDataCompare(livedb.ToConnectionProperties())

        mappings.Options = project2.Options
        mappings.CreateMappings(db1, db2)

        'Disable any mappings here that you may want....
        Dim session As New ComparisonSession
        session.Options = project2.Options
        session.CompareDatabases(db1, db2, mappings)

        Console.WriteLine("Comparison run")
    End Sub
End Class

Requirements

Namespace: RedGate.SQLDataCompare.Engine

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: RedGate.SQLDataCompare.Engine (in RedGate.SQLDataCompare.Engine.dll)

See Also

Project Members  | RedGate.SQLDataCompare.Engine Namespace

 

 


© 2003 - 2006 Red Gate Software Ltd. All Rights Reserved.