Exemplo n.º 1
0
        /// <summary>
        /// Filters rules based on resource type
        /// </summary>
        /// <param name="rules">The collection of input rules</param>
        /// <param name="resourceType">resource type</param>
        /// <returns>The subset of input rules that applies to the context</returns>
        private static IEnumerable<Rule> SelectRulesByConformanceType(this IEnumerable<Rule> rules, ConformanceServiceType resourceType, ConformanceLevelType[] levelTypes = null)
        {
            rules = from r in rules
                   where !r.ResourceType.HasValue || r.ResourceType.Value == resourceType
                   select r;

            if (null != levelTypes && levelTypes.Count() > 0)
            {
                rules = from r in rules
                       where !r.LevelType.HasValue || levelTypes.Contains(r.LevelType.Value)
                       select r;
            }

            return rules;
        }
        /// <summary>
        /// Filters rules based on resource type
        /// </summary>
        /// <param name="rules">The collection of input rules</param>
        /// <param name="resourceType">resource type</param>
        /// <returns>The subset of input rules that applies to the context</returns>
        private static IEnumerable <Rule> SelectRulesByConformanceType(this IEnumerable <Rule> rules, ConformanceServiceType resourceType, ConformanceLevelType[] levelTypes = null)
        {
            rules = from r in rules
                    where !r.ResourceType.HasValue || r.ResourceType.Value == resourceType
                    select r;

            if (null != levelTypes && levelTypes.Count() > 0)
            {
                rules = from r in rules
                        where !r.LevelType.HasValue || levelTypes.Contains(r.LevelType.Value)
                        select r;
            }

            return(rules);
        }