Beispiel #1
0
        public bool IsIncluded <TEntity>(Expression <Func <TEntity, object> > exp)
        {
            var path = CommonUtils.GetPropertyPath <TEntity>(exp);

            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }

            return(IncludePaths != null && IncludePaths.Contains(path));
        }
Beispiel #2
0
        public FilterBase Include <TEntity>(Expression <Func <TEntity, object> > exp)
        {
            var path = CommonUtils.GetPropertyPath <TEntity>(exp);

            if (string.IsNullOrEmpty(path))
            {
                throw new Exception("Invalid property path to include in filter.");
            }

            if (IncludePaths == null)
            {
                IncludePaths = new string[] { path };
                return(this);
            }

            if (!IncludePaths.Contains(path))
            {
                IncludePaths = IncludePaths.Concat(new[] { path }).ToArray();
            }

            return(this);
        }