Table of Contents

Class IDataContextExtensions

Namespace
TimeCockpit.Data
Assembly
TimeCockpit.Data.dll

Extension methods for easier use of IDataContext.

public static class IDataContextExtensions
Inheritance
Object
IDataContextExtensions
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

dataContext IDataContext

Data context to use.

entityObject EntityObject

The 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

dataContext IDataContext

Data context.

action ModelAction

The action that sould be executed.

inputSetUuids IEnumerable<Guid>

The input set uuids on which an action should be executed.

modelEntity ModelEntityBase

The entity type of the input set.

parameter EntityObject

The 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

dataContext IDataContext

Data context.

action ModelAction

The action that sould be executed.

inputSet IEnumerable<EntityObject>

The input set on which an action should be executed.

modelEntity ModelEntityBase

The entity type of the input set.

parameter EntityObject

The 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

dataContext IDataContext

Data context.

action ModelAction

The action that sould be executed.

inputSetUuids IEnumerable<Guid>

The input set uuids on which an action should be executed.

modelEntity ModelEntityBase

The entity type of the input set.

parameter EntityObject

The 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

dataContext IDataContext

Data context.

action ModelAction

The action that sould be executed.

inputSet IEnumerable<EntityObject>

The input set on which an action should be executed.

modelEntity ModelEntityBase

The entity type of the input set.

parameter EntityObject

The 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

dataContext IDataContext

Data 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

dataContext IDataContext

Data context to use.

entityObject EntityObject

The 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

dataContext IDataContext

The data context.

query String

The TCQL query string.

parameters IEnumerable<QueryParameter>

The query parameters.

cache SelectCache

The 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

dataContext IDataContext

The data context.

query String

The TCQL query string.

parameters IEnumerable<QueryParameter>

The query parameters.

cache SelectCache

The 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

dataContext IDataContext

The data context.

query String

The query.

parameters IEnumerable<QueryParameter>

The parameters.

cache SelectCache

The 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

dataContext IDataContext

Data context.

entityObject IEntityObject

Existing (proxy) entity object to (re-)select.

autoIncludeRelations Boolean

Indicates 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

dataContext IDataContext

The data context.

query String

The query.

parameters IEnumerable<QueryParameter>

The parameters.

cache SelectCache

The 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

dataContext IDataContext

Data context.

entityObject IEntityObject

Existing (proxy) entity object to (re-)select.

autoIncludeRelations Boolean

Indicates 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

dataContext IDataContext

Data context to use.

model Model

The 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.