public static ITrackRouteConfiguration ExcludeSourceWithType(this ITrackRouteConfiguration configuration, params Type[] types)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException(nameof(configuration));
     }
     configuration.Exclude(new ExcludeSourceType(types));
     return(configuration);
 }
 public static ITrackRouteConfiguration Exclude(this ITrackRouteConfiguration configuration, Func <PropertyReference, object, Route, bool> excludeFunc)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException(nameof(configuration));
     }
     configuration.Exclude(new RelayExclude(excludeFunc));
     return(configuration);
 }
 public static ITrackRouteConfiguration Exclude(this ITrackRouteConfiguration configuration, params Route[] routes)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException(nameof(configuration));
     }
     configuration.Exclude(new ExcludeRoute(routes));
     return(configuration);
 }
        public static ITrackRouteConfiguration Exclude <TSource>(this ITrackRouteConfiguration configuration,
                                                                 params Expression <Func <TSource, object> >[] propertyExpression)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var objectProperties = propertyExpression.ToLookup(p => typeof(TSource),
                                                               p =>
            {
                var body = p.Body;
                if (body is UnaryExpression unaryExpression)
                {
                    body = unaryExpression.Operand;
                }

                var member = body as MemberExpression;
                if (member == null)
                {
                    var message = $"Expression '{body}' refers to a method, not a property.";
                    throw new ArgumentException(message);
                }

                var propInfo = member.Member as PropertyInfo;
                if (propInfo == null)
                {
                    var message = $"Expression '{body}' refers to a field, not a property.";
                    throw new ArgumentException(message);
                }

                return(propInfo.Name);
            });

            configuration.Exclude(new ExcludeObjectProperty(objectProperties));
            return(configuration);
        }