Class Query
Provides methods to generate query which can be executed against data source using SfDataManager.
Inherited Members
Namespace: Syncfusion.Blazor.Data
Assembly: Syncfusion.Blazor.dll
Syntax
[JsonConverter(typeof(QueryConverter))]
public class Query
Remarks
Methods in this class are chainable.
Constructors
Query()
Declaration
public Query()
Properties
DataManager
Gets the data manager instance.
Declaration
public DataManager DataManager { get; set; }
Property Value
| Type |
|---|
| DataManager |
Distincts
Gets the list of distinct values.
Declaration
public List<string> Distincts { get; set; }
Property Value
| Type |
|---|
| List<string> |
Expands
Specifies the relation table/resource names.
Declaration
public List<object> Expands { get; set; }
Property Value
| Type |
|---|
| List<object> |
FKey
Specifies the foreign key value.
Declaration
public string FKey { get; set; }
Property Value
| Type |
|---|
| string |
FromTable
Specifies the table name.
Declaration
public string FromTable { get; set; }
Property Value
| Type |
|---|
| string |
Remarks
Table name is used by the remote adaptors.
GroupedColumns
Gets the group column details.
Declaration
public object[] GroupedColumns { get; set; }
Property Value
| Type |
|---|
| object[] |
IdMapping
Gets the id mapping value used for child data source process.
Declaration
public string IdMapping { get; set; }
Property Value
| Type |
|---|
| string |
IsChild
Specifies the presence of child.
Declaration
public bool IsChild { get; set; }
Property Value
| Type |
|---|
| bool |
IsCountRequired
Specifies that count value is required in responses from remote services.
Declaration
public bool IsCountRequired { get; set; }
Property Value
| Type |
|---|
| bool |
Key
Specifies the primary key value.
Declaration
public string Key { get; set; }
Property Value
| Type |
|---|
| string |
Lookups
Specifies the lookup table names.
Declaration
public string[] Lookups { get; set; }
Property Value
| Type |
|---|
| string[] |
Params
Gets the additional parameters to be used.
Declaration
public IDictionary<string, object> Params { get; set; }
Property Value
| Type |
|---|
| IDictionary<string, object> |
Queries
Provides various method that allow user to generate query. These queries is used by SfDataManager to process given data source and returns resultant records.
Declaration
public DataManagerRequest Queries { get; set; }
Property Value
| Type |
|---|
| DataManagerRequest |
SortedColumns
Gets the sort column details.
Declaration
public object[] SortedColumns { get; set; }
Property Value
| Type |
|---|
| object[] |
SubQuery
Specifies the sub query.
Declaration
public Query SubQuery { get; set; }
Property Value
| Type |
|---|
| Query |
SubQuerySelector
Specifies the sub query details.
Declaration
public string SubQuerySelector { get; set; }
Property Value
| Type |
|---|
| string |
Methods
AddParams(string, object)
Adds additional parameters to the HTTP request sent by SfDataManager.
Declaration
public Query AddParams(string key, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Key value. |
| object | value | Additional parameter value. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Aggregates(string, string)
Performs the aggregate operation in the aggregate type.
Declaration
public Query Aggregates(string field, string type)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | Specifies the field name. |
| string | type | Specifies the aggregate type. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Remarks
Multiple aggregation can be performed by chaining Aggregates method.
Clone()
Performs deep cloning of the given Query.
Declaration
public Query Clone()
Returns
| Type | Description |
|---|---|
| Query | Query. |
Distinct(List<string>)
Gets the distinct records of the given field from the data source.
Declaration
public Query Distinct(List<string> fieldNames)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | fieldNames | List of field names. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Remarks
Applicable only for ODataV4Adaptor.
Expand(List<string>)
Sets the relational tables to be eager loaded.
Declaration
public Query Expand(List<string> fieldNames)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | fieldNames | List of relational table names. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Remarks
Given table names should be eager loaded. Lazy loading is not supported.
From(string)
Adds the table or resource name.
Declaration
public Query From(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Table name. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Group(List<string>, IDictionary<string, string>)
Groups the data source.
Declaration
public Query Group(List<string> fieldNames, IDictionary<string, string> groupFormat = null)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | fieldNames | Specifies the column names to group. |
| IDictionary<string, string> | groupFormat | Specifies the group format. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Group(string)
Groups the data source.
Declaration
public Query Group(string fieldName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | Specifies the column name. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Group(string, string)
Groups the data source.
Declaration
public Query Group(string fieldName, string columnFormat)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | Specifies the column name. |
| string | columnFormat | Specifies the column format. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
IsEqual(Query, Query)
Compares given Query instance by value.
Declaration
public static bool IsEqual(Query source, Query destination)
Parameters
| Type | Name | Description |
|---|---|---|
| Query | source | Source Query instance. |
| Query | destination | Destination Query instance. |
Returns
| Type |
|---|
| bool |
Page(int, int)
Sets the current page index and page size.
Declaration
public Query Page(int pageIndex, int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageIndex | Specifies the current page. |
| int | pageSize | Specifies the page size. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Remarks
Use this method to get chunk of records from the given data source.
Range(int, int)
Gets the range of records.
Declaration
public Query Range(int start, int end)
Parameters
| Type | Name | Description |
|---|---|---|
| int | start | Range start index. |
| int | end | Range end index. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
RequiresCount()
Specifies that count is expected in remote service response.
Declaration
public Query RequiresCount()
Returns
| Type | Description |
|---|---|
| Query | Query. |
Search(string, List<string>, string, bool, bool)
Searches the records with the given query.
Declaration
public Query Search(string searchKey, List<string> fieldNames, string @operator = null, bool ignoreCase = false, bool ignoreAccent = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | searchKey | Specifies the search key. |
| List<string> | fieldNames | Specifies the field names. |
| string | operator | Specifies the search operator. |
| bool | ignoreCase | Performs case sensitive search. |
| bool | ignoreAccent | Ignore accents/diacritic words during searching. |
Returns
| Type |
|---|
| Query |
Remarks
Multiple Search method can be chained to create complex search criteria.
Select(List<string>)
Selects the given fields from data source.
Declaration
public Query Select(List<string> fieldNames)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | fieldNames | List of fields to select. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Skip(int)
Sets the skip index.
Declaration
public Query Skip(int skip)
Parameters
| Type | Name | Description |
|---|---|---|
| int | skip | Number of records to skip. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Skip(int, int)
Sets the current page index and page size.
Declaration
public Query Skip(int pageIndex, int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageIndex | Specifies the current page. |
| int | pageSize | Specifies the page size. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Sort(string, string)
Sorts the data source.
Declaration
public Query Sort(string name, string direction = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Specifies the sort name. |
| string | direction | Specifies the sort direction. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Sort(string, string, object)
Sorts the data source.
Declaration
public Query Sort(string name, string direction = null, object comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Specifies the sort name. |
| string | direction | Specifies the sort direction. |
| object | comparer | Specifies the comparer object. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Take(int)
Sets the take index.
Declaration
public Query Take(int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageSize | Maximum index of the record. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Where(WhereFilter)
Filters the records with the given query.
Declaration
public Query Where(WhereFilter predicate)
Parameters
| Type | Name | Description |
|---|---|---|
| WhereFilter | predicate | Specifies the predicate to be used. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Remarks
Multiple Where method can be chained to create complex filter criteria.
Where(List<WhereFilter>)
Filters the records with the given query.
Declaration
public Query Where(List<WhereFilter> predicates)
Parameters
| Type | Name | Description |
|---|---|---|
| List<WhereFilter> | predicates | Specifies the list of predicates to be used. |
Returns
| Type | Description |
|---|---|
| Query | Query |
Remarks
Multiple Where method can be chained to create complex filter criteria.
Where(string, string, object, bool, bool)
Filters the records with the given query.
Declaration
public Query Where(string fieldName, string @operator = null, object value = null, bool ignoreCase = false, bool ignoreAccent = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | Specifies the field name. |
| string | operator | Specifies the operator. |
| object | value | Specifies the filter value. |
| bool | ignoreCase | Performs case sensitive filter. |
| bool | ignoreAccent | Ignore accents/diacritic words during filtering. |
Returns
| Type | Description |
|---|---|
| Query | Query. |
Remarks
Multiple Where method can be chained to create complex filter criteria.