UnitOfWork
Namespace: Babel.Data Assembly: Babel.Data.dll
A UnitOfWork instance represents a combination Unit Of Work and Repository patterns such that it can be used to query from a database and group together changes that will then be written back to the store as a unit.
Inheritance
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
UnitOfWork()
Initializes a new instance of the UnitOfWork class. The Configure(Action<DbContextOptionsBuilder> config) method will be called to allow further configuration of the options.
UnitOfWork(BabelDbContext)
Initializes a new instance of the UnitOfWork class.
Parameters
The Babel database context.
Exceptions
UnitOfWork(string)
Initializes a new instance of the UnitOfWork class.
Parameters
The database connection string.
Exceptions
UnitOfWork(DbContextOptions<BabelDbContext>)
Initializes a new instance of the UnitOfWork class using the specified options. The Configure(Action<DbContextOptionsBuilder> config) method will still be called to allow further configuration of the options.
Parameters
The options for this unit of work context.
Properties
ApiKeyRepository
Gets the API key repository.
Property Value
AssemblyRepository
Gets the Assembly repository.
Property Value
ContactRepository
Gets the contact repository.
Property Value
Context
Gets the Babel database context.
Property Value
CustomerRepository
Gets the customer repository.
Property Value
IsDisposed
Gets a value indicating whether this object is disposed.
Property Value
LicenseRepository
Gets the license repository.
Property Value
LicenseTemplateRepository
Gets the license template repository.
Property Value
LicenseTokenRepository
Gets the license token repository.
Property Value
LicenseTraceRepository
Gets the license trace repository.
Property Value
LogEntryRepository
Gets the log repository.
Property Value
OrderRepository
Gets the order repository.
Property Value
ProductRepository
Gets the product repository.
Property Value
ReleaseRepository
Gets the release repository.
Property Value
ReportPropertyRepository
Gets the report property repository.
Property Value
ReportRepository
Gets the report repository.
Property Value
ResourceRepository
Gets the resource repository.
Property Value
ScriptRepository
Gets the script repository.
Property Value
ScriptTagRepository
Gets the script tag repository.
Property Value
UserRepository
Gets the user repository.
Property Value
Methods
Configure(Action<DbContextOptionsBuilder>)
Configure the database (and other options) to be used for this unit of work. This method is called for each instance of the unit of work that is created.
Parameters
A callback that provide a builder object instance used to create or modify options for this context.
Examples
CreateRepository<T>()
Creates a new instance of a generic repository for the specified entity type.
Returns
A new instance of a generic repository for the specified entity type.
Type Parameters
T
The type of entity for which to create a repository.
Dispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Parameters
True to release both managed and unmanaged resources; false to release only unmanaged resources.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
~UnitOfWork()
Finaliser.
Migrate()
Applies any pending migrations for the context to the database. Will create the database if it does not already exist.
Save()
Saves all changes made in this context to the underlying database.
Returns
True if it succeeds, false if it fails.
SaveAsync()
Asynchronously saves all changes made in this context to the underlying database.
Returns
A task that represents the asynchronous save operation.
Last updated