Class DataUtil
Provides utility method used by data manager.
Inheritance
Namespace: Syncfusion.Blazor.Data
Assembly: Syncfusion.Blazor.dll
Syntax
public static class DataUtil : Object
Methods
GetDynamicValue(DynamicObject, String)
Gets the property value from the DynamicObject.
Declaration
public static object GetDynamicValue(DynamicObject obj, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Dynamic.DynamicObject | obj | Input dynamic object. |
System.String | name | Property name to get. |
Returns
Type | Description |
---|---|
System.Object | object. |
GetExpandoValue(IDictionary<String, Object>, String)
Gets the property value from the ExpandoObject.
Declaration
public static object GetExpandoValue(IDictionary<string, object> obj, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | obj | Input Expando object. |
System.String | name | Property name to get. |
Returns
Type | Description |
---|---|
System.Object | object. |
GetFormattedValue(Object, String)
Formats the given value.
Declaration
public static string GetFormattedValue(object value, string format)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | Value to be formatted. |
System.String | format | Format string. |
Returns
Type | Description |
---|---|
System.String | string. |
GetGroupValue(String, Object)
Gets the property value from object.
Declaration
public static object GetGroupValue(string nameSpace, object from)
Parameters
Type | Name | Description |
---|---|---|
System.String | nameSpace | Property name to be accessed. |
System.Object | from | Source object. |
Returns
Type | Description |
---|---|
System.Object | object - property value. |
GetKeyValue(String, Object)
Gets the property value with the given key.
Declaration
public static string GetKeyValue(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Property name. |
System.Object | value | Source object. |
Returns
Type | Description |
---|---|
System.String | string. |
GetObject(String, Object)
Gets the property value from object.
Declaration
public static object GetObject(string nameSpace, object from)
Parameters
Type | Name | Description |
---|---|---|
System.String | nameSpace | Property name to be accessed. |
System.Object | from | Source object. |
Returns
Type | Description |
---|---|
System.Object | object - property value. |
Remarks
For accessing complex/nested property value, given the nameSpace with field names delimited by dot(.).
GetUrl(String, String, String)
Resolves the given base url and relative url to generate absolute url. And merge query string if any.
Declaration
public static string GetUrl(string baseUrl, string relativeUrl, string queryParams = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseUrl | Base address url. |
System.String | relativeUrl | Relative url. |
System.String | queryParams | Query string. |
Returns
Type | Description |
---|---|
System.String | string - absolute url. |
GetVal(IEnumerable, Int32, String)
Gets the property value from list of object.
Declaration
public static object GetVal(IEnumerable jsonData, int index, string field)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | jsonData | List of object. |
System.Int32 | index | Index of the item to be processed. |
System.String | field | Property name to get value. |
Returns
Type | Description |
---|---|
System.Object | object. |
Group<T>(IEnumerable, String, List<Aggregate>, Int32, IDictionary<String, String>, Boolean, Boolean)
Groups the given data source with the field name.
Declaration
public static IEnumerable Group<T>(IEnumerable jsonArray, string field, List<Aggregate> aggregates, int level, IDictionary<string, string> format, bool isLazyLoad = false, bool isLazyGroupExpandAll = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | jsonArray | Input data source. |
System.String | field | Specifies the group by field name. |
System.Collections.Generic.List<Aggregate> | aggregates | Aggregate details to aggregate grouped records. |
System.Int32 | level | Level of the group. For parent group it is 0. |
System.Collections.Generic.IDictionary<System.String, System.String> | format | Specifies the format and handler method to perform group by format. |
System.Boolean | isLazyLoad | Specifies the isLazyLoad property as true to handle lazy load grouping. |
System.Boolean | isLazyGroupExpandAll | Specifies the isLazyGroupExpandAll as true to perform expand all for lazy load grouping. |
Returns
Type | Description |
---|---|
System.Collections.IEnumerable | IEnumerable - Grouped record. |
Type Parameters
Name | Description |
---|---|
T | Type of the data source elements. |
GroupSorting<T>(IEnumerable, List<Sort>)
Sorts the grouped data source based on the specified sort descriptors and returns the sorted records, when the EnableLazyLoading property is set to true.
Declaration
public static IEnumerable GroupSorting<T>(IEnumerable dataSource, List<Sort> sortedColumns)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | dataSource | Data source to be sorted. |
System.Collections.Generic.List<Sort> | sortedColumns | List of sort criteria. |
Returns
Type | Description |
---|---|
System.Collections.IEnumerable | IEnumerable - sorted records. |
Type Parameters
Name |
---|
T |
PerformAggregation(IEnumerable, List<Aggregate>)
Performs aggregation on the given data source.
Declaration
public static IDictionary<string, object> PerformAggregation(IEnumerable jsonData, List<Aggregate> aggregates)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | jsonData | Input data source. |
System.Collections.Generic.List<Aggregate> | aggregates | List of aggregate to be calculated. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | Dictionary of aggregate results. |
Result<T>(Object[], Boolean, List<Aggregate>, Group<T>)
Declaration
public static IEnumerable Result<T>(object[] jsonData, bool isLazyLoad, List<Aggregate> aggregates, Group<T> groupedArray)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | jsonData | |
System.Boolean | isLazyLoad | |
System.Collections.Generic.List<Aggregate> | aggregates | |
Group<T> | groupedArray |
Returns
Type |
---|
System.Collections.IEnumerable |
Type Parameters
Name |
---|
T |
ToQueryParams(IDictionary<String, Object>)
Converts dictionary of key/value pair to query string.
Declaration
public static string ToQueryParams(IDictionary<string, object> Params)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | Params | Input dictionary value. |
Returns
Type | Description |
---|---|
System.String | string - Query string. |