none
Microsoft Sync Frameowork. provisioning not occuring RRS feed

  • Question

  • I am using Microsoft Sync Framework with Devart dot Connect assemblies to sync mysql PC(dev) and Cloud(production) databases, However, I am unable to get the Provisioning to work that usually occurs before actual synchronization. When I MessageBox the output before devProvision.Apply() it gives me message box alert but not when I do it after provisioning.This tells me that the provisioning is either not happening or taking too long. I wonder if its possible to debug provisioning itself.

    My Tables has only one row, so it shouldn't take too long to provision. I believe time of provisioning is more if you have more tables. I am coding in c#. Here is the code for my two files.I have made sure that there is table 'ptls' defined on PC and both database connection are working (ie. userid passowrd etc are correct).

    namespace DataConsolidationApplication
    {
        partial class Form
        {
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.IContainer components = null;
    
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }
    
            #region Windows Form Designer generated code
    
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                this.ThisPCDatabaseMySQLConnection = new Devart.Data.MySql.MySqlConnection();
                this.CloudDatabaseMySQLConnection = new Devart.Data.MySql.MySqlConnection();
                this.SuspendLayout();
                // 
                // ThisPCDatabaseMySQLConnection
                // 
                this.ThisPCDatabaseMySQLConnection.ConnectionString = "User Id=root;Password=ODYSSEY99GRANITE;Host=localhost;Database=ptls;";
                // 
                // CloudDatabaseMySQLConnection
                // 
                this.CloudDatabaseMySQLConnection.ConnectionString = "User Id=root;Password=ODYSSEY99GRANITE;Host=master.cegtagfijlyq.us-west-2.rds.ama" +
        "zonaws.com;Database=ptls;";
                // 
                // Form
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(284, 262);
                this.Name = "Form";
                this.Text = "Form1";
                this.Load += new System.EventHandler(this.Form_Load);
                this.ResumeLayout(false);
    
            }
    
            #endregion
    
            private Devart.Data.MySql.MySqlConnection ThisPCDatabaseMySQLConnection;
            private Devart.Data.MySql.MySqlConnection CloudDatabaseMySQLConnection;
        }
    }
    
    
    
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using Devart.Data.MySql;
    using Devart.Data.Synchronization;
    using Devart.Data.MySql.Synchronization;
    using Microsoft.Synchronization;
    using Microsoft.Synchronization.Data;
    
    
    namespace DataConsolidationApplication
    {
        public partial class Form : System.Windows.Forms.Form
        {
            public Form()
            {
                InitializeComponent();
            }
    
            private void Form_Load(object sender, EventArgs e)
            {
                //Provisioning PC Database
                //Open the connection
    
                // Define the scope, named ProductsScope
                DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription("DialsScope");
    
                // Retrive the description for the Products table from the database 
                DbSyncTableDescription tableDesc = MySqlSyncDescriptionBuilder.GetDescriptionForTable("dials", ThisPCDatabaseMySQLConnection);
    
                // Add the table description to the scope definition
                scopeDesc.Tables.Add(tableDesc);
    
                // Create the scope
                MySqlSyncScopeProvisioning devProvision = new MySqlSyncScopeProvisioning(ThisPCDatabaseMySQLConnection, scopeDesc);
    
                // Start the provision
                devProvision.Apply();
    
                MessageBox.Show("Here");
                //Provisioning Cloud Database
                //Get definition for ProductsScope from dev
                DbSyncScopeDescription scopeDescription = MySqlSyncDescriptionBuilder.GetDescriptionForScope("dials", ThisPCDatabaseMySQLConnection);
    
                //Provise production using this definition
                SyncScopeProvisioning productionProvisioning = new MySqlSyncScopeProvisioning(CloudDatabaseMySQLConnection, scopeDescription);
    
                productionProvisioning.Apply();
    
                SyncOrchestrator syncOrchestrator = new SyncOrchestrator();
    
                //Specify source database
                syncOrchestrator.RemoteProvider = new MySqlSyncProvider("DevCategoryScope", ThisPCDatabaseMySQLConnection, null, null);
    
                //Specify production database
                syncOrchestrator.LocalProvider = new MySqlSyncProvider("DevCategoryScope", CloudDatabaseMySQLConnection, null, null);
    
                syncOrchestrator.Direction = SyncDirectionOrder.Download;
    
                syncOrchestrator.Synchronize();
            }
        }
    }

    Wednesday, November 8, 2017 5:41 PM