Class DataAccess<T>
Data Access helper.
Implements
IDataAccess<T>
Inherited Members
Namespace: EduCATS.Data
Assembly: EduCATS.dll
Syntax
public class DataAccess<T> : IDataAccess<T> where T : new()
Type Parameters
Name | Description |
---|---|
T | Type for data. |
Constructors
DataAccess(string, Task<object>, string, IPlatformServices)
Constructor.
Declaration
public DataAccess(string messageForError, Task<object> callback, string key = null, IPlatformServices services = null)
Parameters
Type | Name | Description |
---|---|---|
string | messageForError | Error message. |
Task<object> | callback | Callback to invoke. |
string | key | Caching key. |
IPlatformServices | services |
Properties
ErrorMessageKey
Error message localized key.
Declaration
public string ErrorMessageKey { get; set; }
Property Value
Type | Description |
---|---|
string |
IsConnectionError
Is network connection issue.
Declaration
public bool IsConnectionError { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsError
Is error occurred.
Declaration
public bool IsError { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsSessionExpiredError
Is session expired issue.
Declaration
public bool IsSessionExpiredError { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
CheckConnectionEstablished()
Check network connection.
Declaration
public virtual bool CheckConnectionEstablished()
Returns
Type | Description |
---|---|
bool |
|
GetAccess(KeyValuePair<string, HttpStatusCode>)
Parse response and get object.
Declaration
public T GetAccess(KeyValuePair<string, HttpStatusCode> response)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<string, HttpStatusCode> | response | Response. |
Returns
Type | Description |
---|---|
T | Object. |
GetList()
Get objects list.
Declaration
public Task<List<T>> GetList()
Returns
Type | Description |
---|---|
Task<List<T>> | Objects list. |
GetListAccess(KeyValuePair<string, HttpStatusCode>)
Parse response and get list of objects.
Declaration
public List<T> GetListAccess(KeyValuePair<string, HttpStatusCode> response)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<string, HttpStatusCode> | response | Response. |
Returns
Type | Description |
---|---|
List<T> | List of objects. |
GetSingle()
Get single object.
Declaration
public Task<T> GetSingle()
Returns
Type | Description |
---|---|
Task<T> | Single object. |