public override SecurityElement ToXml() { SecurityElement se = PermissionHelper.Element(this.GetType(), version); if (IsUnrestricted()) { se.AddAttribute("Unrestricted", "true"); } else { // attribute is present for both True and False se.AddAttribute("AllowBlankPassword", allowBlankPassword.ToString()); foreach (DictionaryEntry de in _connections) { SecurityElement child = new SecurityElement("add"); child.AddAttribute("ConnectionString", (string)de.Key); object[] restrictionsInfo = (object[])de.Value; child.AddAttribute("KeyRestrictions", (string)restrictionsInfo [0]); KeyRestrictionBehavior krb = (KeyRestrictionBehavior)restrictionsInfo [1]; child.AddAttribute("KeyRestrictionBehavior", krb.ToString()); se.AddChild(child); } } return(se); }
// DBDataPermissionAttribute.KeyRestrictionBehavior internal static ArgumentOutOfRangeException InvalidKeyRestrictionBehavior(KeyRestrictionBehavior value) { #if DEBUG switch (value) { case KeyRestrictionBehavior.PreventUsage: case KeyRestrictionBehavior.AllowOnly: Debug.Assert(false, "valid KeyRestrictionBehavior " + value.ToString()); break; } #endif return(InvalidEnumerationValue(typeof(KeyRestrictionBehavior), (int)value)); }