Exemplo n.º 1
0
        public static ReplicationProperties GetProperties(string connectionString, string publicationLabel)
        {
            string[] vals                = publicationLabel.Split(':');
            string   publisher           = vals[0];
            string   publicationDatabase = vals[1];
            string   publication         = vals[2];

            using (SqlCeReplication repl = new SqlCeReplication())
            {
                repl.SubscriberConnectionString = connectionString;
                repl.Publisher         = publisher;
                repl.Publication       = publication;
                repl.PublisherDatabase = publicationDatabase;
                repl.LoadProperties();
                var props = new ReplicationProperties();
                props.InternetLogin     = repl.InternetLogin;
                props.InternetPassword  = repl.InternetPassword;
                props.InternetUrl       = repl.InternetUrl;
                props.Publication       = repl.Publication;
                props.Publisher         = repl.Publisher;
                props.PublisherDatabase = repl.PublisherDatabase;
                props.PublisherLogin    = repl.PublisherLogin;
                props.PublisherPassword = repl.PublisherPassword;
                if (repl.PublisherSecurityMode == SecurityType.NTAuthentication)
                {
                    props.UseNT = true;
                }
                props.Subscriber = repl.Subscriber;
                props.SubscriberConnectionString = repl.SubscriberConnectionString;
                props.HostName = repl.HostName;
                return(props);
            }
        }
Exemplo n.º 2
0
        public static void DropPublication(string connectionString, string publicationLabel)
        {
            string[] vals                = publicationLabel.Split(':');
            string   publisher           = vals[0];
            string   publicationDatabase = vals[1];
            string   publication         = vals[2];

            using (SqlCeReplication repl = new SqlCeReplication())
            {
                repl.SubscriberConnectionString = connectionString;
                repl.Publisher         = publisher;
                repl.Publication       = publication;
                repl.PublisherDatabase = publicationDatabase;
                repl.LoadProperties();
                repl.DropSubscription(DropOption.LeaveDatabase);
            }
        }
Exemplo n.º 3
0
        public static ReplicationProperties GetProperties(string connectionString, string publicationLabel)
#endif
        {
            string[] vals = publicationLabel.Split(':');
            string publisher = vals[0];
            string publicationDatabase = vals[1];
            string publication = vals[2];
            using (SqlCeReplication repl = new SqlCeReplication())
            {
                repl.SubscriberConnectionString = connectionString;
                repl.Publisher = publisher;
                repl.Publication = publication;
                repl.PublisherDatabase = publicationDatabase;
                repl.LoadProperties();
#if V40
                var props = new ReplicationProperties4();
#else
                var props = new ReplicationProperties();
#endif
                props.InternetLogin = repl.InternetLogin;
                props.InternetPassword = repl.InternetPassword;
                props.InternetUrl = repl.InternetUrl;
                props.Publication = repl.Publication;
                props.Publisher = repl.Publisher;
                props.PublisherDatabase = repl.PublisherDatabase;
                props.PublisherLogin = repl.PublisherLogin;
                props.PublisherPassword = repl.PublisherPassword;
                if (repl.PublisherSecurityMode == SecurityType.NTAuthentication)
                    props.UseNT = true;
                props.Subscriber = repl.Subscriber;
                props.SubscriberConnectionString = repl.SubscriberConnectionString;
                props.HostName = repl.HostName;
                return props;
            }
        }
Exemplo n.º 4
0
 public static void DropPublication(string connectionString, string publicationLabel)
 {
     string[] vals = publicationLabel.Split(':');
     string publisher = vals[0];
     string publicationDatabase = vals[1];
     string publication = vals[2];
     using (SqlCeReplication repl = new SqlCeReplication())
     {
         repl.SubscriberConnectionString = connectionString;
         repl.Publisher = publisher;
         repl.Publication = publication;
         repl.PublisherDatabase = publicationDatabase;
         repl.LoadProperties();
         repl.DropSubscription(DropOption.LeaveDatabase);
     }
 }