Class ODataAdaptor
Handles request and response to and from OData service.
Inherited Members
Namespace: Syncfusion.Blazor.Data
Assembly: Syncfusion.Blazor.dll
Syntax
public class ODataAdaptor : AdaptorBase
Constructors
ODataAdaptor(DataManager)
Initializes a new instance of the ODataAdaptor class with the specified DataManager.
Declaration
public ODataAdaptor(DataManager dataManager)
Parameters
| Type | Name | Description |
|---|---|---|
| DataManager | dataManager |
Properties
Options
Gets or sets the remote options for the OData adaptor.
Declaration
public RemoteOptions Options { get; set; }
Property Value
| Type |
|---|
| RemoteOptions |
ResourceTableName
Gets or sets the name of the resource table used in the OData request.
Declaration
public string? ResourceTableName { get; set; }
Property Value
| Type |
|---|
| string |
Methods
AddParams(RequestOptions, DataManagerRequest)
Adds query parameters to the request options.
Declaration
public override void AddParams(RequestOptions options, DataManagerRequest queries)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options | The request options to update. |
| DataManagerRequest | queries | The data request containing parameters to append. |
Overrides
BatchUpdate(DataManager, object, object, object, Utils, string, int?, Query, object)
Creates an OData batch request to perform multiple CRUD operations in one call.
Declaration
public override object BatchUpdate(DataManager dataManager, object changed, object added, object deleted, Utils e, string keyField, int? dropIndex, Query query = null, object original = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DataManager | dataManager | DataManager instance used for configuration. |
| object | changed | Collection of modified entities. |
| object | added | Collection of newly added entities. |
| object | deleted | Collection of entities to delete. |
| Utils | e | Utility object containing URL and key information. |
| string | keyField | Key field name identifying entities. |
| int? | dropIndex | Index for drag-and-drop operations. |
| Query | query | Query context and parameters.This parameter is optional. |
| object | original | Original data context used in batch operations.This parameter is optional. |
Returns
| Type | Description |
|---|---|
| object | Returns the configured RequestOptions for the batch operation. |
Overrides
BeforeSend(HttpRequestMessage)
Adds required OData headers before sending the HTTP request.
Declaration
public override void BeforeSend(HttpRequestMessage request)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpRequestMessage | request |
Overrides
CheckDate(string)
Check if given value is a valid date or not.
Declaration
protected static bool CheckDate(string date)
Parameters
| Type | Name | Description |
|---|---|---|
| string | date | Input date string. |
Returns
| Type | Description |
|---|---|
| bool | bool. |
GetModelType()
Gets the model type associated with the adaptor.
Declaration
public override Type GetModelType()
Returns
| Type | Description |
|---|---|
| Type | Return model type |
Overrides
GetName()
Gets the adaptor name.
Declaration
public override string GetName()
Returns
| Type | Description |
|---|---|
| string | The adaptor name. |
Overrides
Insert(DataManager, object, string, Query, int)
Creates an OData request to insert a new record.
Declaration
public override object Insert(DataManager dataManager, object data, string tableName = null, Query query = null, int position = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| DataManager | dataManager | DataManager instance used for configuration. |
| object | data | Data entity to insert. |
| string | tableName | Target table name.This parameter is optional. |
| Query | query | Query context and parameters.This parameter is optional. |
| int | position | Position for insertion.This parameter is optional. |
Returns
| Type | Description |
|---|---|
| object | Returns the configured RequestOptions for the insert operation. |
Overrides
IsRemote()
Indicates whether the adaptor performs remote operations.
Declaration
public override bool IsRemote()
Returns
| Type | Description |
|---|---|
| bool | Always returns true. |
Overrides
OnCount(bool)
Returns count query string based on query.
Declaration
public virtual string OnCount(bool e)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | e | Request count value if it is true. |
Returns
| Type | Description |
|---|---|
| string | string. |
OnDistinct(List<string>)
Returns distinct query string based on query.
Declaration
public virtual string OnDistinct(List<string> distincts)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | distincts | List of field names. |
Returns
| Type | Description |
|---|---|
| string | string. |
Remarks
Applicable only for ODataV4 services.
OnEachSearch(SearchFilter)
Returns search query string based on query.
Declaration
public virtual void OnEachSearch(SearchFilter e)
Parameters
| Type | Name | Description |
|---|---|---|
| SearchFilter | e | Search query. |
OnEachSort(DataManagerRequest)
Returns sort query string based on query.
Declaration
public static string OnEachSort(DataManagerRequest queries)
Parameters
| Type | Name | Description |
|---|---|---|
| DataManagerRequest | queries | Query value. |
Returns
| Type | Description |
|---|---|
| string | string. |
OnExpand(List<string>)
Returns expand query string based on query.
Declaration
public static string OnExpand(List<string> expands)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | expands | List of relational table names. |
Returns
| Type | Description |
|---|---|
| string | string. |
OnExpand(List<string>, List<string>)
Returns expand query string based on query.
Declaration
public virtual string OnExpand(List<string> selects, List<string> expands)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | selects | List of fields to select in relational tables. |
| List<string> | expands | List of relational table names. |
Returns
| Type | Description |
|---|---|
| string | string. |
OnPredicate(WhereFilter, DataManagerRequest, bool)
Generates request filter query string from the Query value.
Declaration
public virtual string OnPredicate(WhereFilter filter, DataManagerRequest query, bool requiresCast = false)
Parameters
| Type | Name | Description |
|---|---|---|
| WhereFilter | filter | Filter criteria. |
| DataManagerRequest | query | Query value. |
| bool | requiresCast | Performs value cast. Applicable on search operation. |
Returns
| Type |
|---|
| string |
OnSearch(List<WhereFilter>)
Returns search query string based on query.
Declaration
public virtual void OnSearch(List<WhereFilter> e)
Parameters
| Type | Name | Description |
|---|---|---|
| List<WhereFilter> | e | List of filter queries. |
OnSearch(List<WhereFilter>, object)
Returns search query string based on query.
Declaration
public virtual string OnSearch(List<WhereFilter> e, object additionParams = null)
Parameters
| Type | Name | Description |
|---|---|---|
| List<WhereFilter> | e | List of filter queries. |
| object | additionParams | Additional parameters. |
Returns
| Type | Description |
|---|---|
| string | string. |
OnSelect(List<string>)
Returns select query string based on query.
Declaration
public virtual string OnSelect(List<string> selects)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | selects | List of field names to select. |
Returns
| Type | Description |
|---|---|
| string | string. |
OnTypeCheck(string, string, Type)
Converts a string to the appropriate type based on the specified field and model type.
Declaration
public static object OnTypeCheck(string value, string field, Type ModelType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | |
| string | field | |
| Type | ModelType |
Returns
| Type | Description |
|---|---|
| object | Returns the converted value or the original string if no conversion is applicable. |
PerformDataOperation<T>(object)
Sends an HTTP request for the data operation.
Declaration
public override Task<object> PerformDataOperation<T>(object queries)
Parameters
| Type | Name | Description |
|---|---|---|
| object | queries |
Returns
| Type | Description |
|---|---|
| Task<object> | Returns the HTTP response message. |
Type Parameters
| Name |
|---|
| T |
Overrides
PreventOdataFilter(Query)
Provides method to customize filter query which can be executed against default filter query.
Declaration
public virtual Query PreventOdataFilter(Query query = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Query | query |
Returns
| Type |
|---|
| Query |
ProcessBatchResponse<T>(object, DataManagerRequest)
Processes a batch response.
Declaration
public override Task<object> ProcessBatchResponse<T>(object data, DataManagerRequest queries)
Parameters
| Type | Name | Description |
|---|---|---|
| object | data | The HTTP response message containing the batch payload. |
| DataManagerRequest | queries | The data request context. |
Returns
| Type | Description |
|---|---|
| Task<object> | Returns a CRUDModel with Added records when present; otherwise an empty CRUDModel. |
Type Parameters
| Name |
|---|
| T |
Overrides
ProcessCrudResponse<T>(object, DataManagerRequest)
Processes a single OData CRUD response.
Declaration
public override Task<object> ProcessCrudResponse<T>(object data, DataManagerRequest queries)
Parameters
| Type | Name | Description |
|---|---|---|
| object | data | The HTTP response message to process. |
| DataManagerRequest | queries | The data request context. |
Returns
| Type | Description |
|---|---|
| Task<object> | Returns the deserialized result object or an empty object when no content is present. |
Type Parameters
| Name |
|---|
| T |
Overrides
ProcessQuery(DataManagerRequest)
Processes the specified query.
Declaration
public override object ProcessQuery(DataManagerRequest queries)
Parameters
| Type | Name | Description |
|---|---|---|
| DataManagerRequest | queries | The data manager request. |
Returns
| Type | Description |
|---|---|
| object | Returns the request options for OData API calls. |
Overrides
ProcessResponse<T>(object, DataManagerRequest)
Processes an OData HTTP response.
Declaration
public override Task<object> ProcessResponse<T>(object data, DataManagerRequest queries)
Parameters
| Type | Name | Description |
|---|---|---|
| object | data | The HTTP response message to process. |
| DataManagerRequest | queries | The data request specifying counts, grouping, and aggregates. |
Returns
| Type | Description |
|---|---|
| Task<object> | Returns DataResult when counts are required; otherwise returns the result data. |
Type Parameters
| Name |
|---|
| T |
Overrides
Remove(DataManager, string, object, string, Query)
Creates an OData request to remove a record.
Declaration
public override object Remove(DataManager dataManager, string keyField, object value, string tableName = null, Query query = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DataManager | dataManager | DataManager instance used for configuration. |
| string | keyField | Key field name identifying the entity. |
| object | value | Key value of the entity to remove. |
| string | tableName | Target table name.This parameter is optional. |
| Query | query | Query context and parameters.This parameter is optional. |
Returns
| Type | Description |
|---|---|
| object | Returns the configured RequestOptions for the delete operation. |
Overrides
SetModelType(Type)
Sets the model type for the ODataAdaptor.
Declaration
public override void SetModelType(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type |
Overrides
Update(DataManager, string, object, string, Query, object, IDictionary<string, object>)
Creates an OData request to update an existing record.
Declaration
public override object Update(DataManager dataManager, string keyField, object data, string tableName = null, Query query = null, object original = null, IDictionary<string, object> updateProperties = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DataManager | dataManager | DataManager instance used for configuration. |
| string | keyField | Key field name identifying the entity. |
| object | data | Data entity with updated values. |
| string | tableName | Target table name.This parameter is optional. |
| Query | query | Query context and parameters.This parameter is optional. |
| object | original | Original entity for computing PATCH diffs.This parameter is optional. |
| IDictionary<string, object> | updateProperties | The properties and values to update.This parameter is optional. |
Returns
| Type | Description |
|---|---|
| object | Returns the configured RequestOptions for the update operation. |