Click or drag to resize

MapperFiltersHasFilter Method

Determines the existence of one or more relevant filters in the collection according to provided GetFilterFlags. Note that use of HasFilter(GetFilterFlags, FilterFlags) is preferred over GetFilter(GetFilterFlags) when testing for the existence of filtering.

Namespace:  NetQuarry.Data
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public bool HasFilter(
	GetFilterFlags flags,
	FilterFlags secondaryFlags = 
)

Parameters

flags
Type: NetQuarry.DataGetFilterFlags
Flags specifying which filter items to include. When zero, all items are included.
secondaryFlags (Optional)
Type: NetQuarry.DataFilterFlags
If specified (non-zero), only include filters matching one or more of the secondary flags are included.

Return Value

Type: Boolean
True if one or more matching filters are found, else false.
Remarks
Note that use of HasFilter(GetFilterFlags, FilterFlags) is preferred over GetFilter(GetFilterFlags) when testing for the existence of relevant filters. In particular, for Full-Text Search filters the Clause will be null/empty and filtering is specified via the FullTextSearchValue property. An example of where using GetFilter(GetFilterFlags) would return incorrect results would be attempting to determine if a mapper had any user filtering using code such as: bool userFiltered = map.Filters.GetFilter(GetFilterFlags.IncludeUser).HasValue(); which will return false if the only user filtering in place is an FTS filter (which has no Clause). By contrast, HasFilter(GetFilterFlags, FilterFlags) handles the FTS case and bool userFiltered = map.Filters.HasFilter(GetFilterFlags.IncludeUser); would work properly.
Remarks
Internally the most common use of this method is to test whether or not a mapper has any user-specified filtering, e.g. Filter-By-Form (FBF) or Full-Text Search (FTS). The test for that is bool userFiltered = map.Filters.HasFilter(GetFilterFlags.IncludeUser);. The secondaryFlags can be used for a more specific test, for example, to test whether or not the mapper has, specifically, a user-provided FTS filter, bool userFTS = map.Filters.HasFilter(GetFilterFlags.IncludeUser, FilterFlags.FTS);
See Also