示例#1
0
        internal bool IsSupersetOf(System.Data.OracleClient.DBConnectionString entry)
        {
            switch (this._behavior)
            {
            case KeyRestrictionBehavior.AllowOnly:
                for (System.Data.OracleClient.NameValuePair pair = entry.KeyChain; pair != null; pair = pair.Next)
                {
                    if (!this.ContainsKey(pair.Name) && this.IsRestrictedKeyword(pair.Name))
                    {
                        return(false);
                    }
                }
                break;

            case KeyRestrictionBehavior.PreventUsage:
                if (this._restrictionValues != null)
                {
                    foreach (string str in this._restrictionValues)
                    {
                        if (entry.ContainsKey(str))
                        {
                            return(false);
                        }
                    }
                }
                break;

            default:
                throw System.Data.Common.ADP.InvalidKeyRestrictionBehavior(this._behavior);
            }
            return(true);
        }
示例#2
0
 private DBConnectionString(System.Data.OracleClient.DBConnectionString connectionString, string[] restrictionValues, KeyRestrictionBehavior behavior)
 {
     this._encryptedUsersConnectionString = connectionString._encryptedUsersConnectionString;
     this._parsetable        = connectionString._parsetable;
     this._keychain          = connectionString._keychain;
     this._hasPassword       = connectionString._hasPassword;
     this._restrictionValues = restrictionValues;
     this._restrictions      = null;
     this._behavior          = behavior;
 }
示例#3
0
 private DBConnectionString(System.Data.Common.DbConnectionOptions connectionOptions, string restrictions, KeyRestrictionBehavior behavior, Hashtable synonyms, bool mustCloneDictionary)
 {
     switch (behavior)
     {
     case KeyRestrictionBehavior.AllowOnly:
     case KeyRestrictionBehavior.PreventUsage:
         this._behavior = behavior;
         this._encryptedUsersConnectionString = connectionOptions.UsersConnectionString(false);
         this._hasPassword = connectionOptions.HasPasswordKeyword;
         this._parsetable  = connectionOptions.Parsetable;
         this._keychain    = connectionOptions.KeyChain;
         if (this._hasPassword && !connectionOptions.HasPersistablePassword)
         {
             if (mustCloneDictionary)
             {
                 this._parsetable = (Hashtable)this._parsetable.Clone();
             }
             if (this._parsetable.ContainsKey("password"))
             {
                 this._parsetable["password"] = "******";
             }
             if (this._parsetable.ContainsKey("pwd"))
             {
                 this._parsetable["pwd"] = "*";
             }
             this._keychain = connectionOptions.ReplacePasswordPwd(out this._encryptedUsersConnectionString, true);
         }
         if (!System.Data.Common.ADP.IsEmpty(restrictions))
         {
             this._restrictionValues = ParseRestrictions(restrictions, synonyms);
             this._restrictions      = restrictions;
         }
         return;
     }
     throw System.Data.Common.ADP.InvalidKeyRestrictionBehavior(behavior);
 }