Beispiel #1
0
 private void SampleClientSyncProvider_SchemaCreated(object sender, SchemaCreatedEventArgs e)
 {
     //Call ALTER TABLE on the client. This must be done
     //over the same connection and within the same
     //transaction that Sync Framework uses
     //to create the schema on the client.
     InitialiseSchema(e.Connection, e.Transaction, e.Table.TableName);
     Console.WriteLine("Schema created for " + e.Table.TableName);
 }
Beispiel #2
0
        private void SampleClientSyncProvider_SchemaCreated(object sender, SchemaCreatedEventArgs e)
        {
            string  tableName = e.Table.TableName;
            Utility util      = new Utility();

            //Call ALTER TABLE on the client. This must be done
            //over the same connection and within the same
            //transaction that Synchronization Services uses
            //to create the schema on the client.
            util.MakeSchemaChangesOnClient(e.Connection, e.Transaction, "Customer");
        }
Beispiel #3
0
        private void SampleClientSyncProvider_SchemaCreated(object sender, SchemaCreatedEventArgs e)
        {
            //Call ALTER TABLE on the client. This must be done
            //over the same connection and within the same
            //transaction that Synchronization Services uses
            //to create the schema on the client.
            Utility util = new Utility();

            util.MakeSchemaChangesOnClient(e.Connection, e.Transaction, e.Table.TableName);
            Console.WriteLine("Schema created for " + e.Table.TableName);
        }
 private void SampleClientSyncProvider_SchemaCreated(object sender, SchemaCreatedEventArgs e)
 {
     Console.WriteLine("Schema created for " + e.Table.TableName);
 }
Beispiel #5
0
        //Create client and server log files, and write to them
        //based on data from several EventArgs classes.
        public static void LogEvents(object sender, EventArgs e)
        {
            string logFile = String.Empty;
            string site    = String.Empty;

            if (sender is SampleServerSyncProvider)
            {
                logFile = "ServerLogFile.txt";
                site    = "server";
            }
            else if (sender is SampleClientSyncProvider)
            {
                logFile = "ClientLogFile.txt";
                site    = "client";
            }

            StreamWriter  streamWriter = File.AppendText(logFile);
            StringBuilder outputText   = new StringBuilder();

            if (e is ChangesSelectedEventArgs)
            {
                ChangesSelectedEventArgs args = (ChangesSelectedEventArgs)e;
                outputText.AppendLine("Client ID: " + args.Session.ClientId);
                outputText.AppendLine("Changes selected from " + site + " for group " + args.GroupMetadata.GroupName);
                outputText.AppendLine("Inserts selected from " + site + " for group: " + args.Context.GroupProgress.TotalInserts.ToString());
                outputText.AppendLine("Updates selected from " + site + " for group: " + args.Context.GroupProgress.TotalUpdates.ToString());
                outputText.AppendLine("Deletes selected from " + site + " for group: " + args.Context.GroupProgress.TotalDeletes.ToString());
            }

            else if (e is ChangesAppliedEventArgs)
            {
                ChangesAppliedEventArgs args = (ChangesAppliedEventArgs)e;
                outputText.AppendLine("Client ID: " + args.Session.ClientId);
                outputText.AppendLine("Changes applied to " + site + " for group " + args.GroupMetadata.GroupName);
                outputText.AppendLine("Inserts applied to " + site + " for group: " + args.Context.GroupProgress.TotalInserts.ToString());
                outputText.AppendLine("Updates applied to " + site + " for group: " + args.Context.GroupProgress.TotalUpdates.ToString());
                outputText.AppendLine("Deletes applied to " + site + " for group: " + args.Context.GroupProgress.TotalDeletes.ToString());
            }

            else if (e is SchemaCreatedEventArgs)
            {
                SchemaCreatedEventArgs args = (SchemaCreatedEventArgs)e;
                outputText.AppendLine("Schema creation for group: " + args.Table.SyncGroup.GroupName);
                outputText.AppendLine("Table: " + args.Table.TableName);
                outputText.AppendLine("Direction : " + args.Table.SyncDirection);
                outputText.AppendLine("Creation Option: " + args.Table.CreationOption);
            }

            //<snippetOCS_CS_Events_ApplyChangeFailedEventArgs>
            else if (e is ApplyChangeFailedEventArgs)
            {
                ApplyChangeFailedEventArgs args = (ApplyChangeFailedEventArgs)e;
                outputText.AppendLine("** APPLY CHANGE FAILURE AT " + site.ToUpper() + " **");
                outputText.AppendLine("Table for which failure occurred: " + args.TableMetadata.TableName);
                outputText.AppendLine("Error message: " + args.Error.Message);
            }
            //</snippetOCS_CS_Events_ApplyChangeFailedEventArgs>

            else
            {
                outputText.AppendLine("Unknown event occurred");
            }

            streamWriter.WriteLine(DateTime.Now.ToShortTimeString() + " | " + outputText.ToString());
            streamWriter.Flush();
            streamWriter.Dispose();
        }
Beispiel #6
0
 private void SampleClientSyncProvider_SchemaCreated(object sender, SchemaCreatedEventArgs e)
 {
     //Call ALTER TABLE on the client. This must be done
     //over the same connection and within the same
     //transaction that Synchronization Services uses
     //to create the schema on the client.
     Utility util = new Utility();
     util.MakeSchemaChangesOnClient(e.Connection, e.Transaction, e.Table.TableName);
     Console.WriteLine("Schema created for " + e.Table.TableName);
 }