public bool IsAllowed(PropertyReference reference, Lazy <object> value, Navigation.Route propertyRoute)
        {
            var isIncluded = true;

            if (_includeList.Any())
            {
                isIncluded = false;
                foreach (var include in _includeList)
                {
                    isIncluded = isIncluded || include.Include(reference, value, propertyRoute);
                }
            }

            if (!isIncluded)
            {
                return(false);
            }

            foreach (var exclude in _excludeList)
            {
                if (exclude.Exclude(reference, value, propertyRoute))
                {
                    return(false);
                }
            }

            return(true);
        }
        public bool IsAllowed(PropertyReference reference, Navigation.Route propertyRoute)
        {
            if (reference.TryGetDescriptor(out var descriptor))
            {
                var disableTrackingAttribute = descriptor.Attributes.Enumerate <DisableTrackingAttribute>().FirstOrDefault();
                if (disableTrackingAttribute != null)
                {
                    return(false);
                }
            }

            return(true);
        }
        public TrackRouteConfiguration(object source, Navigation.Route route)
        {
            _source      = source ?? throw new ArgumentNullException(nameof(source));
            _excludeList = new List <IExcludeTrackRoute>
            {
                Excludes.KnownSourceTypes
            };
            _includeList         = new List <IIncludeTrackRoute>();
            _subscriptionStorage = new EventHandlerSubscriptionStorage();
            Route = route ?? throw new ArgumentNullException(nameof(route));

            //Do not track structs
            this.Exclude((reference, value, r) => !reference.SourceType.IsClass);
        }