Nabû 1.0.0
Standardizing .NET developments with abstractions
Nabu.Data.IDao< TContext > Interface Template Reference
+ Inheritance diagram for Nabu.Data.IDao< TContext >:

Public Member Functions

TReturn SelectMethod< T, TSelect, TReturn > (ISpecification< T > spec, Expression< Func< T, TSelect > > mapper, Expression< Func< IQueryable< TSelect >, TReturn > > method)
 Execute method on ReadRequest result as IQueryable.
 
Task< T > AddAsync< T > (T entity, CancellationToken cancellationToken=default)
 Add an entity.
 
Task AddAsync< T > (IEnumerable< T > entities, CancellationToken cancellationToken=default)
 Add entities.
 
Task< bool > AnyAsync< T > (ISpecification< T > spec, CancellationToken cancellationToken=default)
 Check if at least one entity match specification.
 
Task< int > CountAsync< T > (ISpecification< T > spec, CancellationToken cancellationToken=default)
 count entities that match the specification in storage
 
Task DeleteAsync< T > (ISpecification< T > spec, CancellationToken cancellationToken=default)
 Remove all entities that match the specification.
 
Task< T?> FirstOrDefaultAsync< T > (ISpecification< T > spec, CancellationToken cancellationToken=default)
 returns the first entity that matches the specification
 
Task< T?> GetByIdAsync< T > (string id, CancellationToken cancellationToken=default)
 return the entity with specified Id
 
IIncludeEvaluator< T > GetIncludeEvaluator< T > ()
 
Task< IReadOnlyList< T > > ListAllAsync< T > (CancellationToken cancellationToken=default)
 return all entities from storage
 
Task< IReadOnlyList< T > > ListAsync< T > (ISpecification< T > spec, CancellationToken cancellationToken=default)
 Return all entities that match the specification.
 
Task< IReadOnlyList< TSelect > > SelectAllAsync< T, TSelect > (Expression< Func< T, TSelect > > mapper, CancellationToken cancellationToken=default)
 return list of TSelect mapped from all entities from storage
 
Task< IReadOnlyList< TSelect > > SelectAsync< T, TSelect > (ISpecification< T > spec, Expression< Func< T, TSelect > > mapper, CancellationToken cancellationToken=default)
 return list of TSelect mapped from all entities that match the specification
 
Task< TSelect?> SelectByIdAsync< T, TSelect > (string id, Expression< Func< T, TSelect > > mapper, CancellationToken cancellationToken=default)
 return TSelect mapped from entity with specified Id
 
Task< TSelect?> SelectFirstOrDefaultAsync< T, TSelect > (ISpecification< T > spec, Expression< Func< T, TSelect > > mapper, CancellationToken cancellationToken=default)
 return TSelect mapped from first entity that match specification
 
Task< IReadOnlyList< TSelect > > SelectGroupBy< T, TKey, TSelect > (ISpecification< T > spec, Expression< Func< T, TKey > > groupBy, Expression< Func< IGrouping< TKey, T >, TSelect > > mapper, CancellationToken cancellationToken=default)
 return list of TSelect mapped from all entities that match the specification grouped by specified expression
 
Task TransactionBegin (CancellationToken cancellationToken=default)
 Begin transaction.
 
Task TransactionCommit (CancellationToken cancellationToken=default)
 Commit current transaction.
 
Task TransactionMakeSavePoint (string name, CancellationToken cancellationToken=default)
 Make named save point in transaction.
 
Task TransactionRemoveSavePoint (string name, CancellationToken cancellationToken=default)
 Remove named save point in transaction.
 
Task TransactionRollback (CancellationToken cancellationToken=default)
 Rollback current transaction.
 
Task TransactionRollbackToSavePoint (string name, CancellationToken cancellationToken=default)
 Rollback transaction to specified savepoint.
 
Task UpdateAsync< T > (T entity, CancellationToken cancellationToken=default)
 update entity
 
Task UpdateAsync< T > (IEnumerable< T > entities, CancellationToken cancellationToken=default)
 update entities
 
Task UpdateAsync< T > (ISpecification< T > spec, Action< T > updater, CancellationToken cancellationToken=default)
 Apply updater to entities that match specification.
 
Task< IReadOnlyList< TFinal > > EvaluateJoinQuery< T1, T2, TKey, TSelect, TFinal > (IJoinQuery< T1, T2, TKey, TSelect, TFinal > joinQuery, CancellationToken cancellationToken=default)
 Execute read query with multiple Joins.
 

Properties

TContext Context [get]
 

Member Function Documentation

◆ AddAsync< T >() [1/2]

Task Nabu.Data.IDao< TContext >.AddAsync< T > ( IEnumerable< T > entities,
CancellationToken cancellationToken = default )

Add entities.

Parameters
entities
cancellationToken
Template Parameters
T
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ AddAsync< T >() [2/2]

Task< T > Nabu.Data.IDao< TContext >.AddAsync< T > ( T entity,
CancellationToken cancellationToken = default )

Add an entity.

Parameters
entity
cancellationToken
Template Parameters
T
Returns
inserted entity
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ AnyAsync< T >()

Task< bool > Nabu.Data.IDao< TContext >.AnyAsync< T > ( ISpecification< T > spec,
CancellationToken cancellationToken = default )

Check if at least one entity match specification.

Parameters
spec
cancellationToken
Template Parameters
T
Returns
true if at least one entity match specification
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ CountAsync< T >()

Task< int > Nabu.Data.IDao< TContext >.CountAsync< T > ( ISpecification< T > spec,
CancellationToken cancellationToken = default )

count entities that match the specification in storage

Parameters
spec
cancellationToken
Template Parameters
T
Returns
number of entities that match the specification
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ DeleteAsync< T >()

Task Nabu.Data.IDao< TContext >.DeleteAsync< T > ( ISpecification< T > spec,
CancellationToken cancellationToken = default )

Remove all entities that match the specification.

Parameters
spec
cancellationToken
Template Parameters
T
Returns
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ EvaluateJoinQuery< T1, T2, TKey, TSelect, TFinal >()

Task< IReadOnlyList< TFinal > > Nabu.Data.IDao< TContext >.EvaluateJoinQuery< T1, T2, TKey, TSelect, TFinal > ( IJoinQuery< T1, T2, TKey, TSelect, TFinal > joinQuery,
CancellationToken cancellationToken = default )

Execute read query with multiple Joins.

Parameters
joinQuery
cancellationToken
Template Parameters
T1
T2
TKey
TSelect
TFinal
Returns
Type Constraints
T1 :class 
T1 :IEntity 
T1 :new() 
T2 :class 
T2 :IEntity 
T2 :new() 

◆ FirstOrDefaultAsync< T >()

Task< T?> Nabu.Data.IDao< TContext >.FirstOrDefaultAsync< T > ( ISpecification< T > spec,
CancellationToken cancellationToken = default )

returns the first entity that matches the specification

Parameters
spec
cancellationToken
Template Parameters
T
Returns
first entity that matches the specification
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ GetByIdAsync< T >()

Task< T?> Nabu.Data.IDao< TContext >.GetByIdAsync< T > ( string id,
CancellationToken cancellationToken = default )

return the entity with specified Id

Parameters
id
cancellationToken
Template Parameters
T
Returns
entity with specified Id
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ GetIncludeEvaluator< T >()

IIncludeEvaluator< T > Nabu.Data.IDao< TContext >.GetIncludeEvaluator< T > ( )
Type Constraints
T :class 
T :IEntity 

◆ ListAllAsync< T >()

Task< IReadOnlyList< T > > Nabu.Data.IDao< TContext >.ListAllAsync< T > ( CancellationToken cancellationToken = default)

return all entities from storage

Parameters
cancellationToken
Template Parameters
T
Returns
all entities from storage
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ ListAsync< T >()

Task< IReadOnlyList< T > > Nabu.Data.IDao< TContext >.ListAsync< T > ( ISpecification< T > spec,
CancellationToken cancellationToken = default )

Return all entities that match the specification.

Parameters
spec
cancellationToken
Template Parameters
T
Returns
all entities that match the specification
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ SelectAllAsync< T, TSelect >()

Task< IReadOnlyList< TSelect > > Nabu.Data.IDao< TContext >.SelectAllAsync< T, TSelect > ( Expression< Func< T, TSelect > > mapper,
CancellationToken cancellationToken = default )

return list of TSelect mapped from all entities from storage

Parameters
mapper
cancellationToken
Template Parameters
T
TSelect
Returns
list of TSelect mapped from all entities
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ SelectAsync< T, TSelect >()

Task< IReadOnlyList< TSelect > > Nabu.Data.IDao< TContext >.SelectAsync< T, TSelect > ( ISpecification< T > spec,
Expression< Func< T, TSelect > > mapper,
CancellationToken cancellationToken = default )

return list of TSelect mapped from all entities that match the specification

Parameters
spec
mapper
cancellationToken
Template Parameters
T
TSelect
Returns
list of TSelect mapped from all entities that match the specification
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ SelectByIdAsync< T, TSelect >()

Task< TSelect?> Nabu.Data.IDao< TContext >.SelectByIdAsync< T, TSelect > ( string id,
Expression< Func< T, TSelect > > mapper,
CancellationToken cancellationToken = default )

return TSelect mapped from entity with specified Id

Parameters
id
mapper
cancellationToken
Template Parameters
T
TSelect
Returns
TSelect mapped from entity with specified Id
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ SelectFirstOrDefaultAsync< T, TSelect >()

Task< TSelect?> Nabu.Data.IDao< TContext >.SelectFirstOrDefaultAsync< T, TSelect > ( ISpecification< T > spec,
Expression< Func< T, TSelect > > mapper,
CancellationToken cancellationToken = default )

return TSelect mapped from first entity that match specification

Parameters
spec
mapper
cancellationToken
Template Parameters
T
TSelect
Returns
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ SelectGroupBy< T, TKey, TSelect >()

Task< IReadOnlyList< TSelect > > Nabu.Data.IDao< TContext >.SelectGroupBy< T, TKey, TSelect > ( ISpecification< T > spec,
Expression< Func< T, TKey > > groupBy,
Expression< Func< IGrouping< TKey, T >, TSelect > > mapper,
CancellationToken cancellationToken = default )

return list of TSelect mapped from all entities that match the specification grouped by specified expression

Parameters
spec
groupBy
mapper
cancellationToken
Template Parameters
T
TKey
TSelect
Returns
list of TSelect mapped from all entities that match the specification grouped by specified expression
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ SelectMethod< T, TSelect, TReturn >()

TReturn Nabu.Data.IDao< TContext >.SelectMethod< T, TSelect, TReturn > ( ISpecification< T > spec,
Expression< Func< T, TSelect > > mapper,
Expression< Func< IQueryable< TSelect >, TReturn > > method )

Execute method on ReadRequest result as IQueryable.

Parameters
spec
mapper
method
Template Parameters
T
TSelect
TReturn
Returns
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ TransactionBegin()

Task Nabu.Data.IDao< TContext >.TransactionBegin ( CancellationToken cancellationToken = default)

Begin transaction.

Parameters
cancellationToken
Returns

◆ TransactionCommit()

Task Nabu.Data.IDao< TContext >.TransactionCommit ( CancellationToken cancellationToken = default)

Commit current transaction.

Parameters
cancellationToken
Returns

◆ TransactionMakeSavePoint()

Task Nabu.Data.IDao< TContext >.TransactionMakeSavePoint ( string name,
CancellationToken cancellationToken = default )

Make named save point in transaction.

Parameters
name
cancellationToken
Returns

◆ TransactionRemoveSavePoint()

Task Nabu.Data.IDao< TContext >.TransactionRemoveSavePoint ( string name,
CancellationToken cancellationToken = default )

Remove named save point in transaction.

Parameters
name
cancellationToken
Returns

◆ TransactionRollback()

Task Nabu.Data.IDao< TContext >.TransactionRollback ( CancellationToken cancellationToken = default)

Rollback current transaction.

Parameters
cancellationToken
Returns

◆ TransactionRollbackToSavePoint()

Task Nabu.Data.IDao< TContext >.TransactionRollbackToSavePoint ( string name,
CancellationToken cancellationToken = default )

Rollback transaction to specified savepoint.

Parameters
name
cancellationToken
Returns

◆ UpdateAsync< T >() [1/3]

Task Nabu.Data.IDao< TContext >.UpdateAsync< T > ( IEnumerable< T > entities,
CancellationToken cancellationToken = default )

update entities

Parameters
entities
cancellationToken
Template Parameters
T
Returns
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ UpdateAsync< T >() [2/3]

Task Nabu.Data.IDao< TContext >.UpdateAsync< T > ( ISpecification< T > spec,
Action< T > updater,
CancellationToken cancellationToken = default )

Apply updater to entities that match specification.

Parameters
spec
updater
cancellationToken
Template Parameters
T
Returns
Type Constraints
T :class 
T :IEntity 
T :new() 

◆ UpdateAsync< T >() [3/3]

Task Nabu.Data.IDao< TContext >.UpdateAsync< T > ( T entity,
CancellationToken cancellationToken = default )

update entity

Parameters
entity
cancellationToken
Template Parameters
T
Returns
Type Constraints
T :class 
T :IEntity 
T :new()