Interface IDataContext
Interface that wraps the DbContext methods that we are using primarily for testing purposes.
Namespace: Cireson.Core.Interfaces.DataAccess
Assembly: Cireson.Core.Interfaces.dll
Syntax
public interface IDataContext : IDisposable
Remarks
Admin, 8/24/2017.
Properties
View SourceChangeTracker
Access the underlying change tracker.
Declaration
DbChangeTracker ChangeTracker { get; }
Property Value
Type | Description |
---|---|
DbChangeTracker | The change tracker. |
Configuration
Context Configuration.
Declaration
DbContextConfiguration Configuration { get; }
Property Value
Type | Description |
---|---|
DbContextConfiguration | The configuration. |
Database
Access to the underlying database.
Declaration
Database Database { get; }
Property Value
Type | Description |
---|---|
Database | The database. |
Methods
View SourceAddRelationship(Object, Object, String)
Non-Generic means of adding a relationship. The rntity, and related entity must be of type IPlatformEntity
Declaration
void AddRelationship(object entity, object relatedEntity, string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | |
System.Object | relatedEntity | |
System.String | propertyName |
AddRelationship<TEntity, TRelatedEntity>(TEntity, String, TRelatedEntity[])
Declaration
void AddRelationship<TEntity, TRelatedEntity>(TEntity entity, string propertyName, params TRelatedEntity[] relatedEntities)
where TEntity : class, IPlatformEntity where TRelatedEntity : class, IPlatformEntity
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | |
System.String | propertyName | |
TRelatedEntity[] | relatedEntities |
Type Parameters
Name | Description |
---|---|
TEntity | |
TRelatedEntity |
DataPumpSaveChangesAsync()
DataPump save.
Declaration
Task<int> DataPumpSaveChangesAsync()
Returns
Type | Description |
---|---|
Task<System.Int32> | An asynchronous result that yields the data pump save changes. |
DeleteById<TEntity>(Nullable<Int64>)
Deletes an entity by the given id.
Declaration
void DeleteById<TEntity>(long? id)
where TEntity : class, IPlatformEntity
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int64> | id | . |
Type Parameters
Name | Description |
---|---|
TEntity | . |
Entry(Object)
Retrieves the specified entity.
Declaration
DbEntityEntry Entry(object entity)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | . |
Returns
Type | Description |
---|---|
DbEntityEntry | A DbEntityEntry. |
Entry<TEntity>(TEntity)
Retrieves the specified entity.
Declaration
DbEntityEntry Entry<TEntity>(TEntity entity)
where TEntity : class, IPlatformEntity
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | . |
Returns
Type | Description |
---|---|
DbEntityEntry | A DbEntityEntry. |
Type Parameters
Name | Description |
---|---|
TEntity | . |
GetValidationErrors()
Retrieves all validation errors.
Declaration
IEnumerable<DbEntityValidationResult> GetValidationErrors()
Returns
Type | Description |
---|---|
IEnumerable<DbEntityValidationResult> | An enumerator that allows foreach to be used to process the validation errors in this collection. |
RemoveRelationship(Object, Object, String)
Non-Generic means of removing a relationship. The rntity, and related entity must be of type IPlatformEntity
Declaration
void RemoveRelationship(object entity, object relatedEntity, string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | |
System.Object | relatedEntity | |
System.String | propertyName |
RemoveRelationship<TEntity, TRelatedEntity>(TEntity, Expression<Func<TEntity, Object>>, TRelatedEntity[])
Removes the relationship.
Declaration
void RemoveRelationship<TEntity, TRelatedEntity>(TEntity entity, Expression<Func<TEntity, object>> propertyExpression, params TRelatedEntity[] relatedEntities)
where TEntity : class, IPlatformEntity where TRelatedEntity : class, IPlatformEntity
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | . |
Expression<Func<TEntity, System.Object>> | propertyExpression | The property expression. |
TRelatedEntity[] | relatedEntities | A variable-length parameters list containing related entities. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of the entity. |
TRelatedEntity | Type of the related entity. |
RemoveRelationship<TEntity, TRelatedEntity>(TEntity, String, TRelatedEntity[])
Removes the relationship.
Declaration
void RemoveRelationship<TEntity, TRelatedEntity>(TEntity entity, string propertyName, params TRelatedEntity[] relatedEntities)
where TEntity : class, IPlatformEntity where TRelatedEntity : class, IPlatformEntity
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | . |
System.String | propertyName | Name of the property. |
TRelatedEntity[] | relatedEntities | A variable-length parameters list containing related entities. |
Type Parameters
Name | Description |
---|---|
TEntity | Type of the entity. |
TRelatedEntity | Type of the related entity. |
SaveChanges()
Commits all context changes to db.
Declaration
int SaveChanges()
Returns
Type | Description |
---|---|
System.Int32 | An int. |
SaveChangesAsync()
Saves changes asyncronously.
Declaration
Task<int> SaveChangesAsync()
Returns
Type | Description |
---|---|
Task<System.Int32> | An asynchronous result that yields the save changes. |
SaveChangesAsync(CancellationToken)
Saves changes async, and provides a cancellation token.
Declaration
Task<int> SaveChangesAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | . |
Returns
Type | Description |
---|---|
Task<System.Int32> | An asynchronous result that yields the save changes. |
Set(Type)
Accesses an untyped entityset for the given type.
Declaration
DbSet Set(Type entityType)
Parameters
Type | Name | Description |
---|---|---|
Type | entityType | . |
Returns
Type | Description |
---|---|
DbSet | A DbSet. |
Set<TEntity>()
Access the typed entityset.
Declaration
IDbSet<TEntity> Set<TEntity>()
where TEntity : class, IPlatformEntity
Returns
Type | Description |
---|---|
IDbSet<TEntity> | An IDbSet<TEntity> |
Type Parameters
Name | Description |
---|---|
TEntity | . |
ToString()
Convert this object into a string representation.
Declaration
string ToString()
Returns
Type | Description |
---|---|
System.String | A string that represents this object. |