예제 #1
0
        private static bool IsValidProperty(PropertyInfo prop, IKinesisAppenderFilter filter)
        {
            if (!(prop.GetCustomAttributes(typeof(IPropertyValidationAttribute), true).FirstOrDefault() is IPropertyValidationAttribute validation))
            {
                return(true);
            }

            return(validation.IsValid(prop.GetValue(filter, null)));
        }
예제 #2
0
        public static void ValidateFilterProperties(IKinesisAppenderFilter filter)
        {
            var invalidProperties =
                filter.GetType().GetProperties()
                .Where(prop => !IsValidProperty(prop, filter))
                .Select(p => p.Name).ToList();

            if (invalidProperties.Any())
            {
                var properties = string.Join(",", invalidProperties.ToArray());
                throw new InvalidFilterConfigurationException(
                          string.Format("The properties ({0}) of {1} are invalid.", properties, filter.GetType().Name));
            }
        }
예제 #3
0
 public void AddFilter(IKinesisAppenderFilter filter)
 {
     _filters.Add(filter);
 }