Class IDataContextExtensions
- Namespace
- TimeCockpit.Data
- Assembly
- TimeCockpit.Data.dll
Extension methods for easier use of IDataContext.
public static class IDataContextExtensions
- Inheritance
-
ObjectIDataContextExtensions
- Inherited Members
-
Object.ToString()Object.Equals(Object)Object.Equals(Object, Object)Object.ReferenceEquals(Object, Object)Object.GetHashCode()Object.GetType()Object.MemberwiseClone()
Methods
DeleteObject(IDataContext, EntityObject)
Deletes a given EntityObject.
public static void DeleteObject(this IDataContext dataContext, EntityObject entityObject)
Parameters
dataContextIDataContextData context to use.
entityObjectEntityObjectThe EntityObject to delete.
ExecuteAction(IDataContext, ModelAction, IEnumerable<Guid>, ModelEntityBase, EntityObject)
Executes an instance of a ModelAction.
public static ActionResult ExecuteAction(this IDataContext dataContext, ModelAction action, IEnumerable<Guid> inputSetUuids, ModelEntityBase modelEntity, EntityObject parameter)
Parameters
dataContextIDataContextData context.
actionModelActionThe action that sould be executed.
inputSetUuidsIEnumerable<Guid>The input set uuids on which an action should be executed.
modelEntityModelEntityBaseThe entity type of the input set.
parameterEntityObjectThe parameter that is passed into the action.
Returns
- ActionResult
The output of the action
ExecuteAction(IDataContext, ModelAction, IEnumerable<EntityObject>, ModelEntityBase, EntityObject)
Executes an instance of a ModelAction.
public static ActionResult ExecuteAction(this IDataContext dataContext, ModelAction action, IEnumerable<EntityObject> inputSet, ModelEntityBase modelEntity, EntityObject parameter)
Parameters
dataContextIDataContextData context.
actionModelActionThe action that sould be executed.
inputSetIEnumerable<EntityObject>The input set on which an action should be executed.
modelEntityModelEntityBaseThe entity type of the input set.
parameterEntityObjectThe parameter that is passed into the action.
Returns
- ActionResult
The output of the action
ExecuteActionAsync(IDataContext, ModelAction, IEnumerable<Guid>, ModelEntityBase, EntityObject)
Executes an instance of a ModelAction.
public static Task<ActionResult> ExecuteActionAsync(this IDataContext dataContext, ModelAction action, IEnumerable<Guid> inputSetUuids, ModelEntityBase modelEntity, EntityObject parameter)
Parameters
dataContextIDataContextData context.
actionModelActionThe action that sould be executed.
inputSetUuidsIEnumerable<Guid>The input set uuids on which an action should be executed.
modelEntityModelEntityBaseThe entity type of the input set.
parameterEntityObjectThe parameter that is passed into the action.
Returns
- Task<ActionResult>
The output of the action
ExecuteActionAsync(IDataContext, ModelAction, IEnumerable<EntityObject>, ModelEntityBase, EntityObject)
Executes an instance of a ModelAction.
public static Task<ActionResult> ExecuteActionAsync(this IDataContext dataContext, ModelAction action, IEnumerable<EntityObject> inputSet, ModelEntityBase modelEntity, EntityObject parameter)
Parameters
dataContextIDataContextData context.
actionModelActionThe action that sould be executed.
inputSetIEnumerable<EntityObject>The input set on which an action should be executed.
modelEntityModelEntityBaseThe entity type of the input set.
parameterEntityObjectThe parameter that is passed into the action.
Returns
- Task<ActionResult>
The output of the action
RefreshModelAsync(IDataContext)
Refresh the model using a async task.
public static Task RefreshModelAsync(this IDataContext dataContext)
Parameters
dataContextIDataContextData context.
Returns
- Task
Task representing the refresh operation.
SaveObject(IDataContext, EntityObject)
Saves a given EntityObject.
public static void SaveObject(this IDataContext dataContext, EntityObject entityObject)
Parameters
dataContextIDataContextData context to use.
entityObjectEntityObjectThe EntityObject to save.
Select(IDataContext, String, IEnumerable<QueryParameter>, SelectCache)
Performs a select.
public static EntityObject[] Select(this IDataContext dataContext, string query, IEnumerable<QueryParameter> parameters = null, SelectCache cache = null)
Parameters
dataContextIDataContextThe data context.
queryStringThe TCQL query string.
parametersIEnumerable<QueryParameter>The query parameters.
cacheSelectCacheThe select cache.
Returns
- EntityObject[]
Asynchronously returns the resulting entity objects.
SelectAsync(IDataContext, String, IEnumerable<QueryParameter>, SelectCache)
Asynchronously performs a select.
public static Task<EntityObject[]> SelectAsync(this IDataContext dataContext, string query, IEnumerable<QueryParameter> parameters = null, SelectCache cache = null)
Parameters
dataContextIDataContextThe data context.
queryStringThe TCQL query string.
parametersIEnumerable<QueryParameter>The query parameters.
cacheSelectCacheThe select cache.
Returns
- Task<EntityObject[]>
Asynchronously returns the resulting entity objects.
SelectSingle(IDataContext, String, IEnumerable<QueryParameter>, SelectCache)
Asynchronously selects a single entity.
public static EntityObject SelectSingle(this IDataContext dataContext, string query, IEnumerable<QueryParameter> parameters = null, SelectCache cache = null)
Parameters
dataContextIDataContextThe data context.
queryStringThe query.
parametersIEnumerable<QueryParameter>The parameters.
cacheSelectCacheThe select cache.
Returns
- EntityObject
Returns the single entity object.
SelectSingle(IDataContext, IEntityObject, Boolean)
Select single based on an existing IEntityObject.
public static EntityObject SelectSingle(this IDataContext dataContext, IEntityObject entityObject, bool autoIncludeRelations = false)
Parameters
dataContextIDataContextData context.
entityObjectIEntityObjectExisting (proxy) entity object to (re-)select.
autoIncludeRelationsBooleanIndicates whether relations should be included.
Returns
- EntityObject
Single entity object or null if not found.
SelectSingleAsync(IDataContext, String, IEnumerable<QueryParameter>, SelectCache)
Asynchronously selects a single entity.
public static Task<EntityObject> SelectSingleAsync(this IDataContext dataContext, string query, IEnumerable<QueryParameter> parameters = null, SelectCache cache = null)
Parameters
dataContextIDataContextThe data context.
queryStringThe query.
parametersIEnumerable<QueryParameter>The parameters.
cacheSelectCacheThe select cache.
Returns
- Task<EntityObject>
Returns the single entity object.
SelectSingleAsync(IDataContext, IEntityObject, Boolean)
Select single based on an existing IEntityObject.
public static Task<EntityObject> SelectSingleAsync(this IDataContext dataContext, IEntityObject entityObject, bool autoIncludeRelations = false)
Parameters
dataContextIDataContextData context.
entityObjectIEntityObjectExisting (proxy) entity object to (re-)select.
autoIncludeRelationsBooleanIndicates whether relations should be included.
Returns
- Task<EntityObject>
Single entity object or null if not found.
UserHasAdminRole(IDataContext, Model)
Gets a value indicating whether the user is admin or not.
public static bool UserHasAdminRole(this IDataContext dataContext, Model model = null)
Parameters
dataContextIDataContextData context to use.
modelModelThe model that hold the permissions
Returns
- Boolean
True if APP_AdminPermission matches or is not found.
Remarks
If the APP_AdminPermission is not found or system mode is enabled we assume admin.