[Serializable] |
Like any code group, FirstMatchCodeGroup only applies when its membership condition matches evidence for an assembly. If there is a match, it tests the membership condition of each child in order, stopping when the first match occurs. The result of FirstMatchCodeGroup is the union of the policy statement of the root code group and the policy statement of the first child group of that code group that matches.
FirstMatchCodeGroup is intended for programmatic use by application domain hosts to set domain policy.
ctor #1 | Initializes a new instance of the FirstMatchCodeGroup class. |
AttributeString (inherited from System.Security.Policy.CodeGroup) |
Read-only See base class member description: System.Security.Policy.CodeGroup.AttributeString Gets a string representation of the attributes of the policy statement for the code group. |
Children (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.Children Gets or sets an ordered list of the child code groups of a code group. |
Description (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.Description Gets or sets the description of the code group. |
MembershipCondition (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.MembershipCondition Gets or sets the code group's membership condition. |
MergeLogic | Read-only Overridden: Gets the merge logic. |
Name (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.Name Gets or sets the name of the code group. |
PermissionSetName (inherited from System.Security.Policy.CodeGroup) |
Read-only See base class member description: System.Security.Policy.CodeGroup.PermissionSetName Gets the name of the named permission set for the code group. |
PolicyStatement (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.PolicyStatement Gets or sets the policy statement associated with the code group. |
AddChild (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.AddChild Adds a child code group to the current code group. |
Copy | Overridden: Makes a deep copy of the code group. |
Equals (inherited from System.Security.Policy.CodeGroup) |
Overloaded:Equals(object o) See base class member description: System.Security.Policy.CodeGroup.EqualsDetermines whether the specified code group is equivalent to the current code group. |
Equals (inherited from System.Security.Policy.CodeGroup) |
Overloaded:Equals(CodeGroup cg, bool compareChildren) See base class member description: System.Security.Policy.CodeGroup.EqualsDetermines whether the specified code group is equivalent to the current code group, checking the child code groups as well, if specified. |
FromXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:FromXml(SecurityElement e) See base class member description: System.Security.Policy.CodeGroup.FromXmlReconstructs a security object with a given state from an XML encoding. |
FromXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:FromXml(SecurityElement e, PolicyLevel level) See base class member description: System.Security.Policy.CodeGroup.FromXmlReconstructs a security object with a given state and policy level from an XML encoding. |
GetHashCode (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.GetHashCode Gets the hash code of the current code group. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
RemoveChild (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.RemoveChild Removes the specified child code group. |
Resolve | Overridden: Resolves policy for the code group and its descendants for a set of evidence. |
ResolveMatchingCodeGroups | Overridden: Resolves matching code groups. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
ToXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:ToXml() See base class member description: System.Security.Policy.CodeGroup.ToXmlCreates an XML encoding of the security object and its current state. |
ToXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:ToXml(PolicyLevel level) See base class member description: System.Security.Policy.CodeGroup.ToXmlCreates an XML encoding of the security object, its current state, and the policy level within which the code exists. |
CreateXml (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.CreateXml When overridden in a derived class, serializes properties and internal state specific to a derived code group and adds the serialization to the specified SecurityElement. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
ParseXml (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.ParseXml When overridden in a derived class, reconstructs properties and internal state specific to a derived code group from the specified SecurityElement. |
Hierarchy:
public FirstMatchCodeGroup( |
membershipCondition
policy
Exception Type | Condition |
---|---|
ArgumentException | The type of the membershipCondition parameter is not valid. -or- The type of the policy parameter is not valid. |
public virtual string AttributeString {get;}
|
public IList Children {get; set;}
|
Exception Type | Condition |
---|---|
ArgumentException | An attempt is made to set this property to null. |
public string Description {get; set;}
|
public IMembershipCondition MembershipCondition {get; set;}
|
Exception Type | Condition |
---|---|
ArgumentException | An attempt is made to set this parameter to null. |
public override string MergeLogic {get;}
|
public string Name {get; set;}
|
public virtual string PermissionSetName {get;}
|
public PolicyStatement PolicyStatement {get; set;}
|
This property can also be set by passing a policy statement to the constructor.
codeGroup.PolicyStatement = new PolicyStatement(new NamedPermissionSet("MyPermissionSet"));
public void AddChild( |
group
Exception Type | Condition |
---|---|
ArgumentNullException | The group parameter is null. |
ArgumentException | The group parameter is not a valid code group. |
public override CodeGroup Copy(); |
protected virtual void CreateXml( |
element
level
The XML created using this method is deserialized by the CodeGroup.ParseXml method.
o
This method tests the top-level code group only, not its child code groups.
cg
compareChildren
If the compareChildren parameter is true, this method will only return true if the current code group and all its child code groups are equivalent to the specified code group and all its child code groups.
~FirstMatchCodeGroup(); |
public void FromXml( |
e
Exception Type | Condition |
---|---|
ArgumentNullException | The e parameter is null. |
public void FromXml( |
e
level
Exception Type | Condition |
---|---|
ArgumentNullException | The e parameter is null. |
public override int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
protected virtual void ParseXml( |
e
level
This method deserializes XML created using CodeGroup.CreateXml.
public void RemoveChild( |
group
Exception Type | Condition |
---|---|
ArgumentException | The group parameter is not an immediate child code group of the current code group. |
public override PolicyStatement Resolve( |
evidence
Exception Type | Condition |
---|---|
ArgumentNullException | The evidence parameter is null. |
PolicyException | More than one code group (including the parent code group and any child code groups) is marked PolicyStatementAttribute.Exclusive. |
For first-match code groups, each child code group's membership condition is tested against the evidence in the order in which they were added; only the first match is resolved with the evidence set. If there are no matches, the policy statement of the parent first-match code group applies. The matching child code group type determines how all child groups under it are applied, depending on how the CodeGroup.Resolve methods of these child groups work.
The .NET Framework security system uses CodeGroup.Resolve on the policy levels to determine which permissions to grant to loaded code from the resulting policy statements and the code request on the assembly.
This operation of this method is as follows:
If the membership condition does not match the specified evidence, return null; otherwise, set the permission set to be returned (P) equal to the code group's policy statement and continue. For each child code group, resolve the code group with the same evidence; if the result is not null, return that policy statement. If no child code group matched, return P (the parent's policy statement).
evidence
Exception Type | Condition |
---|---|
ArgumentException | The evidence parameter is null. |
For first-match code groups, each child code group's membership condition is tested against the evidence in the order in which they were added; only the first match is resolved with the evidence set. If there are no matches, the policy statement of the parent first-match code group applies. The matching child code group type determines how all child groups under it are applied, depending on how the CodeGroup.ResolveMatchingCodeGroups methods of these child groups work.
public virtual string ToString(); |
public SecurityElement ToXml(); |
public SecurityElement ToXml( |
level