Class Query
Provides methods to generate query which can be executed against data source using SfDataManager.
Inheritance
Namespace: Syncfusion.Blazor.Data
Assembly: Syncfusion.Blazor.dll
Syntax
public class Query : Object
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 |
---|
System.Collections.Generic.List<System.String> |
Expands
Specifies the relation table/resource names.
Declaration
public List<object> Expands { get; set; }
Property Value
Type |
---|
System.Collections.Generic.List<System.Object> |
FKey
Specifies the foreign key value.
Declaration
public string FKey { get; set; }
Property Value
Type |
---|
System.String |
FromTable
Specifies the table name.
Declaration
public string FromTable { get; set; }
Property Value
Type |
---|
System.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 |
---|
System.Object[] |
IdMapping
Gets the id mapping value used for child data source process.
Declaration
public string IdMapping { get; set; }
Property Value
Type |
---|
System.String |
IsChild
Specifies the presence of child.
Declaration
public bool IsChild { get; set; }
Property Value
Type |
---|
System.Boolean |
IsCountRequired
Specifies that count value is required in responses from remote services.
Declaration
public bool IsCountRequired { get; set; }
Property Value
Type |
---|
System.Boolean |
Key
Specifies the primary key value.
Declaration
public string Key { get; set; }
Property Value
Type |
---|
System.String |
Lookups
Specifies the lookup table names.
Declaration
public string[] Lookups { get; set; }
Property Value
Type |
---|
System.String[] |
Params
Gets the additional parameters to be used.
Declaration
public IDictionary<string, object> Params { get; set; }
Property Value
Type |
---|
System.Collections.Generic.IDictionary<System.String, System.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 |
---|
System.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 |
---|
System.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 |
---|---|---|
System.String | key | Key value. |
System.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 |
---|---|---|
System.String | field | Specifies the field name. |
System.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 |
---|---|---|
System.Collections.Generic.List<System.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 |
---|---|---|
System.Collections.Generic.List<System.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 |
---|---|---|
System.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 |
---|---|---|
System.Collections.Generic.List<System.String> | fieldNames | Specifies the column names to group. |
System.Collections.Generic.IDictionary<System.String, System.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 |
---|---|---|
System.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 |
---|---|---|
System.String | fieldName | Specifies the column name. |
System.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 |
---|
System.Boolean |
Page(Int32, Int32)
Sets the current page index and page size.
Declaration
public Query Page(int pageIndex, int pageSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | Specifies the current page. |
System.Int32 | 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(Int32, Int32)
Gets the range of records.
Declaration
public Query Range(int start, int end)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | start | Range start index. |
System.Int32 | 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, Boolean, Boolean)
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 |
---|---|---|
System.String | searchKey | Specifies the search key. |
System.Collections.Generic.List<System.String> | fieldNames | Specifies the field names. |
System.String | operator | Specifies the search operator. |
System.Boolean | ignoreCase | Performs case sensitive search. |
System.Boolean | 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 |
---|---|---|
System.Collections.Generic.List<System.String> | fieldNames | List of fields to select. |
Returns
Type | Description |
---|---|
Query | Query. |
Skip(Int32)
Sets the skip index.
Declaration
public Query Skip(int skip)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | skip | Number of records to skip. |
Returns
Type | Description |
---|---|
Query | Query. |
Skip(Int32, Int32)
Sets the current page index and page size.
Declaration
public Query Skip(int pageIndex, int pageSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | Specifies the current page. |
System.Int32 | 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 |
---|---|---|
System.String | name | Specifies the sort name. |
System.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 |
---|---|---|
System.String | name | Specifies the sort name. |
System.String | direction | Specifies the sort direction. |
System.Object | comparer | Specifies the comparer object. |
Returns
Type | Description |
---|---|
Query | Query. |
Take(Int32)
Sets the take index.
Declaration
public Query Take(int pageSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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 |
---|---|---|
System.Collections.Generic.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, Boolean, Boolean)
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 |
---|---|---|
System.String | fieldName | Specifies the field name. |
System.String | operator | Specifies the operator. |
System.Object | value | Specifies the filter value. |
System.Boolean | ignoreCase | Performs case sensitive filter. |
System.Boolean | ignoreAccent | Ignore accents/diacritic words during filtering. |
Returns
Type | Description |
---|---|
Query | Query. |
Remarks
Multiple Where method can be chained to create complex filter criteria.