internal static bool CheckMembershipCondition(IMembershipCondition membershipCondition, Evidence evidence, out object usedEvidence) { IReportMatchMembershipCondition condition = membershipCondition as IReportMatchMembershipCondition; if (condition != null) { return condition.Check(evidence, out usedEvidence); } usedEvidence = null; evidence.MarkAllEvidenceAsUsed(); return membershipCondition.Check(evidence); }
#pragma warning restore 618 /// <summary> /// Check the membership condition to see if it matches the given evidence, and if the /// membership condition supports it also return the evidence which was used to match the /// membership condition. /// </summary> internal static bool CheckMembershipCondition(IMembershipCondition membershipCondition, Evidence evidence, out object usedEvidence) { BCLDebug.Assert(membershipCondition != null, "membershipCondition != null"); BCLDebug.Assert(evidence != null, "evidence != null"); IReportMatchMembershipCondition reportMatchMembershipCondition = membershipCondition as IReportMatchMembershipCondition; // If the membership condition supports telling us which evidence was used to match, then use // that capability. Otherwise, we cannot report this information - which means we need to be // conservative and assume that all of the evidence was used and mark it as such. if (reportMatchMembershipCondition != null) { return reportMatchMembershipCondition.Check(evidence, out usedEvidence); } else { usedEvidence = null; evidence.MarkAllEvidenceAsUsed(); return membershipCondition.Check(evidence); } }
#pragma warning disable 618 internal static PolicyStatement ResolveCodeGroup(CodeGroup codeGroup, Evidence evidence) { // Custom code groups won't know how to mark the evidence they're using, so we need to // be pessimistic and mark it all as used if we encounter a code group from outside of mscorlib. if (codeGroup.GetType().Assembly != typeof(UnionCodeGroup).Assembly) { evidence.MarkAllEvidenceAsUsed(); } return codeGroup.Resolve(evidence); }
internal static PolicyStatement ResolveCodeGroup(CodeGroup codeGroup, Evidence evidence) { if (codeGroup.GetType().Assembly != typeof(UnionCodeGroup).Assembly) { evidence.MarkAllEvidenceAsUsed(); } return codeGroup.Resolve(evidence); }