示例#1
0
        /// <summary>
        /// Sets the filters for the result set.
        /// </summary>
        /// <param name="filterSet">
        /// The filters to set.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="filterSet"/> is null.
        /// </exception>
        protected void SetFilters([NotNull] ValueFilterSet <T> filterSet)
        {
            if (filterSet == null)
            {
                throw new ArgumentNullException(nameof(filterSet));
            }

            this.valueFilters.Clear();
            this.valueFilters.AddRange(filterSet.ValueFilters);
        }
示例#2
0
        /// <summary>
        /// Defines the filters to restrict results to.
        /// </summary>
        /// <param name="setFilter">
        /// The entity set filter.
        /// </param>
        /// <returns>
        /// The current <see cref="EntitySet{T}"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="setFilter"/> is null.
        /// </exception>
        public EntitySet <T> Where([NotNull] Action <ValueFilterSet <T> > setFilter)
        {
            if (setFilter == null)
            {
                throw new ArgumentNullException(nameof(setFilter));
            }

            var filterSet = new ValueFilterSet <T>();

            setFilter.Invoke(filterSet);
            this.SetFilters(filterSet);
            return(this);
        }
示例#3
0
        /// <summary>
        /// Defines the entity set to update.
        /// </summary>
        /// <param name="set">
        /// The entity set to update.
        /// </param>
        /// <returns>
        /// The current <see cref="UpdateSet{T}"/>.
        /// </returns>
        public UpdateSet <T> Where([NotNull] Action <ValueFilterSet <T> > set)
        {
            if (set == null)
            {
                throw new ArgumentNullException(nameof(set));
            }

            var target = new ValueFilterSet <T>();

            set.Invoke(target);
            this.filters.Clear();
            this.filters.AddRange(target.ValueFilters);
            return(this);
        }