public DataSourceInfo(string originalName, string referenceName, Guid linkID) { this.m_id = Guid.NewGuid(); this.m_name = originalName; this.m_originalName = originalName; this.InitDefaultsOnCreation(); this.m_credentialsRetrieval = CredentialsRetrievalOption.Prompt; this.m_dataSourceReference = referenceName; this.m_linkID = linkID; }
private void InitDefaultsOnCreation() { this.m_extension = null; this.m_dataSourceReference = null; this.m_linkID = Guid.Empty; this.m_credentialsRetrieval = CredentialsRetrievalOption.Unknown; this.m_prompt = string.Format(CultureInfo.CurrentCulture, RPRes.rsDataSourcePrompt); this.m_userNameEncrypted = null; this.m_passwordEncrypted = null; this.m_flags = (DataSourceFlags.Enabled | DataSourceFlags.ReferenceIsValid); this.m_originalConnectStringExpressionBased = false; }
public void LinkModelToDataSource(DataSourceInfo standAlone, Guid modelID) { this.m_DataSourceWithCredentialsId = standAlone.m_DataSourceWithCredentialsId; this.m_extension = standAlone.m_extension; this.m_connectionStringEncrypted = standAlone.m_connectionStringEncrypted; this.m_credentialsRetrieval = standAlone.CredentialsRetrieval; this.m_prompt = standAlone.Prompt; this.m_userNameEncrypted = standAlone.m_userNameEncrypted; this.m_passwordEncrypted = standAlone.m_passwordEncrypted; this.Enabled = standAlone.Enabled; this.ImpersonateUser = standAlone.ImpersonateUser; this.m_flags = standAlone.m_flags; this.m_modelID = modelID; this.m_isEmbeddedInModel = false; this.IsModel = true; }
public void LinkToStandAlone(DataSourceInfo standAlone, string standAlonePath, Guid standAloneCatalogItemId) { this.m_name = standAlone.m_name; this.m_extension = standAlone.m_extension; this.m_connectionStringEncrypted = standAlone.m_connectionStringEncrypted; this.m_dataSourceReference = standAlonePath; this.m_linkID = standAloneCatalogItemId; this.m_secDesc = standAlone.m_secDesc; this.m_credentialsRetrieval = standAlone.CredentialsRetrieval; this.m_prompt = standAlone.m_prompt; this.m_userNameEncrypted = standAlone.m_userNameEncrypted; this.m_passwordEncrypted = standAlone.m_passwordEncrypted; this.Enabled = standAlone.Enabled; this.ImpersonateUser = standAlone.ImpersonateUser; this.WindowsCredentials = standAlone.WindowsCredentials; }
public DataSourceInfo(string originalName, string extension, string connectionString, bool integratedSecurity, string prompt, IDataProtection dataProtection) { this.m_id = Guid.NewGuid(); this.m_name = originalName; this.m_originalName = originalName; this.InitDefaultsOnCreation(); this.m_prompt = prompt; if (integratedSecurity) { this.m_credentialsRetrieval = CredentialsRetrievalOption.Integrated; } else { this.m_credentialsRetrieval = CredentialsRetrievalOption.Prompt; } this.m_extension = extension; this.SetConnectionString(connectionString, dataProtection); }
public DataSourceInfo(string originalName, string extension, string connectionString, bool originalConnectStringExpressionBased, bool integratedSecurity, string prompt, IDataProtection dataProtection) { m_id = Guid.NewGuid(); m_name = originalName; m_originalName = originalName; InitDefaultsOnCreation(); m_prompt = prompt; if (integratedSecurity) { m_credentialsRetrieval = CredentialsRetrievalOption.Integrated; } else { m_credentialsRetrieval = CredentialsRetrievalOption.Prompt; } m_extension = extension; SetOriginalConnectionString(connectionString, dataProtection); m_originalConnectStringExpressionBased = originalConnectStringExpressionBased; }
public DataSourceInfo(SerializationInfo info, StreamingContext context) { this.m_id = (Guid)info.GetValue("id", typeof(Guid)); this.m_DataSourceWithCredentialsId = (Guid)info.GetValue("originalid", typeof(Guid)); this.m_name = (string)info.GetValue("name", typeof(string)); this.m_originalName = (string)info.GetValue("originalname", typeof(string)); this.m_extension = (string)info.GetValue("extension", typeof(string)); this.m_connectionStringEncrypted = (byte[])info.GetValue("connectionstringencrypted", typeof(byte[])); this.m_originalConnectionStringEncrypted = (byte[])info.GetValue("originalconnectionstringencrypted", typeof(byte[])); this.m_originalConnectStringExpressionBased = (bool)info.GetValue("originalConnectStringExpressionBased", typeof(bool)); this.m_dataSourceReference = (string)info.GetValue("datasourcereference", typeof(string)); this.m_linkID = (Guid)info.GetValue("linkid", typeof(Guid)); this.m_secDesc = (byte[])info.GetValue("secdesc", typeof(byte[])); this.m_credentialsRetrieval = (CredentialsRetrievalOption)info.GetValue("credentialsretrieval", typeof(CredentialsRetrievalOption)); this.m_prompt = (string)info.GetValue("prompt", typeof(string)); this.m_userNameEncrypted = (byte[])info.GetValue("usernameencrypted", typeof(byte[])); this.m_passwordEncrypted = (byte[])info.GetValue("passwordencrypted", typeof(byte[])); this.m_flags = (DataSourceFlags)info.GetValue("datasourceflags", typeof(DataSourceFlags)); this.m_modelID = (Guid)info.GetValue("modelid", typeof(Guid)); this.m_modelLastUpdatedTime = (DateTime?)info.GetValue("modellastupdatedtime", typeof(DateTime?)); this.m_isEmbeddedInModel = (bool)info.GetValue("isembeddedinmodel", typeof(bool)); }
public DataSourceInfo(Guid id, Guid originalId, string name, string originalName, string extension, byte[] connectionStringEncrypted, byte[] originalConnectionStringEncypted, bool originalConnectStringExpressionBased, string dataSourceReference, Guid linkID, byte[] secDesc, CredentialsRetrievalOption credentialsRetrieval, string prompt, byte[] userNameEncrypted, byte[] passwordEncrypted, int flags, bool isModelSecurityUsed) { this.m_id = id; this.m_DataSourceWithCredentialsId = originalId; this.m_name = name; this.m_originalName = originalName; this.m_extension = extension; this.m_connectionStringEncrypted = connectionStringEncrypted; this.m_originalConnectionStringEncrypted = originalConnectionStringEncypted; this.m_originalConnectStringExpressionBased = originalConnectStringExpressionBased; this.m_dataSourceReference = dataSourceReference; this.m_linkID = linkID; this.m_secDesc = secDesc; this.m_credentialsRetrieval = credentialsRetrieval; this.m_prompt = prompt; if (this.m_credentialsRetrieval != CredentialsRetrievalOption.Store && (userNameEncrypted != null || passwordEncrypted != null)) { throw new InternalCatalogException("unexpected data source type"); } this.m_userNameEncrypted = userNameEncrypted; this.m_passwordEncrypted = passwordEncrypted; this.m_flags = (DataSourceFlags)flags; this.m_isModelSecurityUsed = isModelSecurityUsed; }
private bool ParseDefinitionXml(XmlNode root, IDataProtection dataProtection) { try { if (root == null) { throw new InvalidXmlException(); } string connectionString = null; bool flag = false; foreach (XmlNode childNode in root.ChildNodes) { string name = childNode.Name; string innerText = childNode.InnerText; switch (name) { case "Extension": this.Extension = innerText; break; case "ConnectString": connectionString = innerText; break; case "UseOriginalConnectString": try { flag = bool.Parse(innerText); } catch (ArgumentException) { throw new ElementTypeMismatchException("UseOriginalConnectString"); } break; case "CredentialRetrieval": try { this.m_credentialsRetrieval = (CredentialsRetrievalOption)Enum.Parse(typeof(CredentialsRetrievalOption), innerText, true); } catch (ArgumentException) { throw new ElementTypeMismatchException("CredentialRetrieval"); } break; case "WindowsCredentials": try { this.WindowsCredentials = bool.Parse(innerText); } catch (Exception) { throw new ElementTypeMismatchException("WindowsCredentials"); } break; case "ImpersonateUser": try { this.ImpersonateUser = bool.Parse(innerText); } catch (FormatException) { throw new ElementTypeMismatchException("ImpersonateUser"); } break; case "Prompt": this.m_prompt = innerText; break; case "UserName": this.SetUserName(innerText, dataProtection); break; case "Password": this.SetPassword(innerText, dataProtection); break; case "Enabled": try { this.Enabled = bool.Parse(innerText); } catch (FormatException) { throw new ElementTypeMismatchException("Enabled"); } break; default: throw new InvalidXmlException(); case "OriginalConnectStringExpressionBased": break; } } if (flag) { this.SetConnectionString(null, dataProtection); } else { this.SetConnectionString(connectionString, dataProtection); } return(flag); } catch (XmlException) { throw new InvalidXmlException(); } }