Skip to content

QueryBuilder

The QueryBuilder class is really useful if you want to manually build your query Or when you don't want to use the extension methods.

MethodDescription
AddConditionAdds a string base Filtering query
AddOrderByAdds a string base Ordering query
ConfigurePagingConfigure Page and PageSize
AddQueryAccepts a GridifyQuery object to configure filtering,ordering and paging
UseCustomMapperAccepts a GridifyMapper to use in build methods
UseEmptyMapperSetup an Empty new GridifyMapper without auto generated mappings
AddMapAdd a single Map to existing mapper
RemoveMapRemove a single Map from existing mapper
ConfigureDefaultMapperConfiguring default mapper when we didn't use AddMapper method
IsValidValidates Condition, OrderBy, Query , Mapper and returns a bool
BuildApplies filtering ordering and paging to a queryable context
BuildCompiledCompiles the expressions and returns a delegate for applying filtering ordering and paging to a enumerable collection
BuildFilteringExpressionReturns filtering expression that can be compiled for later use for enumerable collections
BuildEvaluatorReturns an evaluator delegate that can be use to evaluate an queryable context
BuildCompiledEvaluatorReturns an compiled evaluator delegate that can be use to evaluate an enumerable collection
BuildWithPagingApplies filtering ordering and paging to a context, and returns paging result
BuildWithPagingCompiledCompiles the expressions and returns a delegate for applying filtering ordering and paging to a enumerable collection, that returns paging result
BuildWithQueryablePagingApplies filtering ordering and paging to a context, and returns queryable paging result
EvaluateDirectly Evaluate a context to check if all conditions are valid or not
csharp
var builder = new QueryBuilder<Person>()
        .AddCondition("name=John")
        .AddOrderBy("age, id");

var query = builder.Build(persons);