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); } }
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; } }