/// <summary>
        ///     Check to see if the passed in CE provider needs Schema from server
        /// </summary>
        /// <param name="localProvider"></param>
        private void CheckIfProviderNeedsSchema(SqlSyncProvider localProvider)
        {
            if (localProvider != null)
            {
                var ceConn   = (SqlConnection)localProvider.Connection;
                var ceConfig =
                    new SqlSyncScopeProvisioning(ceConn);
                ceConfig.ObjectSchema = "dbo";
                var scopeName = localProvider.ScopeName;

                //if the scope does not exist in this store
                if (!ceConfig.ScopeExists(scopeName))
                {
                    //create a reference to the server proxy
                    var serverProxy =
                        new RelationalProviderTestProxy(scopeName,
                                                        Settings.Default.ServiceUrl);

                    //retrieve the scope description from the server
                    var scopeDesc = serverProxy.GetScopeDescription();
                    serverProxy.Dispose();

                    //use scope description from server to intitialize the client
                    ceConfig.PopulateFromScopeDescription(scopeDesc);
                    ceConfig.Apply();
                }
            }
        }
        public SyncResults Synchronize()
        {
            SyncResults results = null;
            // Create the SQL CE Sync Provider for the given scope name


            var localProvider =
                ConfigureSQLSyncProvider("NorthwindServerSyncConfig");

            // Create the remote provider for the given scope name
            var destinationProxy =
                new RelationalProviderTestProxy("NorthwindServerSyncConfig",
                                                Settings.Default.ServiceUrl);

            destinationProxy.DestinationCallbacks.ItemConflicting += Program_ItemConflicting;
            destinationProxy.DestinationCallbacks.ItemConstraint  += Program_ItemConstraint;

            // Synchronize and collect results
            results = new SyncResults("NorthwindServerSyncConfig",
                                      SynchronizeProviders(localProvider, destinationProxy,
                                                           SyncDirectionOrder.DownloadAndUpload));
            destinationProxy.Dispose();
            localProvider.Dispose();
            return(results);
        }