示例#1
0
        /// <summary>
        /// Returns true if the policy is of the expected type. Takes care of checking for lazy policies.
        /// </summary>
        /// <param name="securityPolicy">The policy</param>
        /// <returns>A boolean</returns>
        internal static bool IsPolicyOf <TSecurityPolicy>(this ISecurityPolicy securityPolicy) where TSecurityPolicy : class, ISecurityPolicy
        {
            var isMatch = securityPolicy is TSecurityPolicy;

            if (!isMatch)
            {
                isMatch = securityPolicy.GetPolicyType() == typeof(TSecurityPolicy);
            }
            return(isMatch);
        }
示例#2
0
 /// <summary>
 /// Returns true if the policy implements ICacheKeyProvider
 /// </summary>
 /// <param name="securityPolicy">The policy</param>
 /// <returns>A boolean</returns>
 internal static bool IsCacheKeyProvider(this ISecurityPolicy securityPolicy)
 {
     return(typeof(ICacheKeyProvider).IsAssignableFrom(securityPolicy.GetPolicyType()));
 }