Show / Hide Table of Contents

Class DataSpaceExtensions

Extension methods for IDataSpace.

Inheritance
System.Object
DataSpaceExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Data
Assembly: Kephas.Data.dll
Syntax
public static class DataSpaceExtensions

Methods

| Improve this Doc View Source

CreateAsync(IDataSpace, ICreateEntityContext, CancellationToken)

Creates asynchronously a new entity of the provided type and returns it.

Declaration
public static Task<object> CreateAsync(this IDataSpace dataSpace, ICreateEntityContext operationContext, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

ICreateEntityContext operationContext

Context for the create entity operation (optional).

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

A promise of the created entity.

| Improve this Doc View Source

CreateAsync(IDataSpace, Type, CancellationToken)

Creates asynchronously a new entity of the provided type and returns it.

Declaration
public static Task<object> CreateAsync(this IDataSpace dataSpace, Type entityType, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

System.Type entityType

Type of the entity to create.

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

A promise of the created entity.

| Improve this Doc View Source

CreateAsync<T>(IDataSpace, ICreateEntityContext, CancellationToken)

Creates asynchronously a new entity of the provided type and returns it.

Declaration
public static Task<T> CreateAsync<T>(this IDataSpace dataSpace, ICreateEntityContext operationContext, CancellationToken cancellationToken = default(CancellationToken))

    where T : class
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

ICreateEntityContext operationContext

Context for the create entity operation (optional).

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the created entity.

Type Parameters
Name Description
T

The type of the entity to create.

| Improve this Doc View Source

CreateAsync<T>(IDataSpace, CancellationToken)

Creates asynchronously a new entity of the provided type and returns it.

Declaration
public static Task<T> CreateAsync<T>(this IDataSpace dataSpace, CancellationToken cancellationToken = default(CancellationToken))

    where T : class
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the created entity.

Type Parameters
Name Description
T

The type of the entity to create.

| Improve this Doc View Source

Delete<T>(IDataSpace, T[])

Marks the provided entity for deletion in the data context.

Declaration
public static void Delete<T>(this IDataSpace dataSpace, params T[] entities)

    where T : class
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

T[] entities

The entities to delete.

Type Parameters
Name Description
T

The type of the entity.

| Improve this Doc View Source

Delete<T>(IDataSpace, IEnumerable<T>)

Marks the provided entity for deletion in the data context.

Declaration
public static void Delete<T>(this IDataSpace dataSpace, IEnumerable<T> entities)

    where T : class
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

System.Collections.Generic.IEnumerable<T> entities

The entities to delete.

Type Parameters
Name Description
T

The type of the entity.

| Improve this Doc View Source

DiscardChanges(IDataSpace)

Discards the changes in the data context.

Declaration
public static IEnumerable<IDataCommandResult> DiscardChanges(this IDataSpace dataSpace)
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

Returns
Type Description
System.Collections.Generic.IEnumerable<IDataCommandResult>

The result of discarding the changes.

| Improve this Doc View Source

FindAsync(IDataSpace, IFindContext, CancellationToken)

Searches for the entity with the provided ID and returns it asynchronously.

Declaration
public static Task<object> FindAsync(this IDataSpace dataSpace, IFindContext findContext, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

IFindContext findContext

Context for the find operation.

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

A promise of the found entity.

| Improve this Doc View Source

FindAsync(IDataSpace, Type, Object, Boolean, CancellationToken)

Searches for the entity with the provided ID and returns it asynchronously.

Declaration
public static Task<object> FindAsync(this IDataSpace dataSpace, Type entityType, object id, bool throwIfNotFound = true, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

System.Type entityType

Type of the entity.

System.Object id

The entity ID.

System.Boolean throwIfNotFound

If true and an entity with the provided ID is not found, an exception occurs (optional).

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

A promise of the found entity.

| Improve this Doc View Source

FindAsync<T>(IDataSpace, IFindContext, CancellationToken)

Searches for the entity with the provided ID and returns it asynchronously.

Declaration
public static Task<T> FindAsync<T>(this IDataSpace dataSpace, IFindContext findContext, CancellationToken cancellationToken = default(CancellationToken))

    where T : class
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

IFindContext findContext

Context for the find operation.

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the found entity.

Type Parameters
Name Description
T

The type of the entity.

| Improve this Doc View Source

FindAsync<T>(IDataSpace, Object, Boolean, CancellationToken)

Searches for the entity with the provided ID and returns it asynchronously.

Declaration
public static Task<T> FindAsync<T>(this IDataSpace dataSpace, object id, bool throwIfNotFound = true, CancellationToken cancellationToken = default(CancellationToken))

    where T : class
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

System.Object id

The entity ID.

System.Boolean throwIfNotFound

If true and an entity with the provided ID is not found, an exception occurs.

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the found entity.

Type Parameters
Name Description
T

The type of the entity.

| Improve this Doc View Source

FindOneAsync(IDataSpace, IFindOneContext, CancellationToken)

Searches for the first entity matching the provided criteria and returns it asynchronously.

Declaration
public static Task<object> FindOneAsync(this IDataSpace dataSpace, IFindOneContext findContext, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

IFindOneContext findContext

The find context.

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

A promise of the found entity.

| Improve this Doc View Source

FindOneAsync<T>(IDataSpace, IFindOneContext, CancellationToken)

Searches for the first entity matching the provided criteria and returns it asynchronously.

Declaration
public static Task<T> FindOneAsync<T>(this IDataSpace dataSpace, IFindOneContext findContext, CancellationToken cancellationToken = default(CancellationToken))

    where T : class
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

IFindOneContext findContext

The find context.

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the found entity.

Type Parameters
Name Description
T

The type of the entity.

| Improve this Doc View Source

FindOneAsync<T>(IDataSpace, Expression<Func<T, Boolean>>, Boolean, CancellationToken)

Searches for the first entity matching the provided criteria and returns it asynchronously.

Declaration
public static Task<T> FindOneAsync<T>(this IDataSpace dataSpace, Expression<Func<T, bool>> criteria, bool throwIfNotFound = true, CancellationToken cancellationToken = default(CancellationToken))

    where T : class
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> criteria

The criteria.

System.Boolean throwIfNotFound

true to throw if not found (optional).

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the found entity.

Type Parameters
Name Description
T

The type of the entity.

| Improve this Doc View Source

GetEntityEntry<T>(IDataSpace, T)

An IDataSpace extension method that gets The entity entry.

Declaration
public static IEntityEntry GetEntityEntry<T>(this IDataSpace dataSpace, T entity)
Parameters
Type Name Description
IDataSpace dataSpace

The dataSpace to act on.

T entity

The entity.

Returns
Type Description
IEntityEntry

The entity entry.

Type Parameters
Name Description
T

Generic type parameter.

| Improve this Doc View Source

PersistChangesAsync(IDataSpace, CancellationToken)

Persists the changes in the dataContext asynchronously.

Declaration
public static Task<IEnumerable<IDataCommandResult>> PersistChangesAsync(this IDataSpace dataSpace, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

System.Threading.CancellationToken cancellationToken

The cancellation token (optional).

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<IDataCommandResult>>

A promise of the persist result.

| Improve this Doc View Source

Query<T>(IDataSpace, IQueryOperationContext)

Gets a query over the entity type for the given query operation context, if any is provided.

Declaration
public static IQueryable<T> Query<T>(this IDataSpace dataSpace, IQueryOperationContext operationContext = null)

    where T : class
Parameters
Type Name Description
IDataSpace dataSpace

The data space to act on.

IQueryOperationContext operationContext

Context for the query.

Returns
Type Description
System.Linq.IQueryable<T>

A query over the entity type.

Type Parameters
Name Description
T

The entity type.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX