Exemplo n.º 1
0
 public void CheckedAdd(DataSourceInfo dataSource)
 {
     if (dataSource.CredentialsRetrieval == DataSourceInfo.CredentialsRetrievalOption.Prompt)
     {
         PromptBucket bucketByLinkID       = this.GetBucketByLinkID(dataSource.LinkID);
         PromptBucket bucketByOriginalName = this.GetBucketByOriginalName(dataSource.PromptIdentifier);
         if (bucketByLinkID == null)
         {
             if (bucketByOriginalName == null)
             {
                 PromptBucket promptBucket = new PromptBucket();
                 promptBucket.Add(dataSource);
                 this.Add(promptBucket);
             }
             else
             {
                 bucketByOriginalName.Add(dataSource);
             }
         }
         else if (bucketByOriginalName == null)
         {
             bucketByLinkID.Add(dataSource);
         }
         else if (bucketByLinkID == bucketByOriginalName)
         {
             bucketByLinkID.Add(dataSource);
         }
         else
         {
             bucketByLinkID.AddRange(bucketByOriginalName);
             this.Remove(bucketByOriginalName);
             bucketByLinkID.Add(dataSource);
         }
     }
 }
Exemplo n.º 2
0
        private void SetCredentials(DatasourceCredentials credentials, IDataProtection dataProtection)
        {
            string promptID = credentials.PromptID;

            if (this.m_collectionByPrompt == null)
            {
                if (this.GetByOriginalName(promptID) != null)
                {
                    throw new DataSourceNoPromptException(promptID);
                }
                throw new DataSourceNotFoundException(promptID);
            }
            PromptBucket bucketByOriginalName = this.m_collectionByPrompt.GetBucketByOriginalName(promptID);

            if (bucketByOriginalName == null)
            {
                if (this.GetByOriginalName(promptID) != null)
                {
                    throw new DataSourceNoPromptException(promptID);
                }
                throw new DataSourceNotFoundException(promptID);
            }
            bucketByOriginalName.SetCredentials(credentials, dataProtection);
        }