internal void CheckedAdd(DataSourceInfo dataSource)
        {
            if (dataSource.CredentialsRetrieval != DataSourceInfo.CredentialsRetrievalOption.Prompt)
            {
                return;
            }
            PromptBucket bucketByLinkID       = GetBucketByLinkID(dataSource.LinkID);
            PromptBucket bucketByOriginalName = GetBucketByOriginalName(dataSource.PromptIdentifier);

            if (bucketByLinkID == null)
            {
                if (bucketByOriginalName == null)
                {
                    PromptBucket promptBucket = new PromptBucket();
                    promptBucket.Add(dataSource);
                    Add(promptBucket);
                }
                else
                {
                    bucketByOriginalName.Add(dataSource);
                }
            }
            else if (bucketByOriginalName == null)
            {
                bucketByLinkID.Add(dataSource);
            }
            else if (bucketByLinkID == bucketByOriginalName)
            {
                bucketByLinkID.Add(dataSource);
            }
            else
            {
                bucketByLinkID.AddRange(bucketByOriginalName);
                Remove(bucketByOriginalName);
                bucketByLinkID.Add(dataSource);
            }
        }
Beispiel #2
0
        private void SetCredentials(DatasourceCredentials credentials, IDataProtection dataProtection)
        {
            string promptID = credentials.PromptID;

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

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