DbContext Class
Namespace: Nucleus.Data.EntityFramework
Assembly: Nucleus.Data.EntityFramework.dll
Entity-framework dbcontext implementation.
Constructor
Nucleus.Data.EntityFramework.DbContext
Constructor
Nucleus.Data.EntityFramework.DbContext (DbContextConfigurator dbContextConfigurator, IHttpContextAccessor httpContextAccessor, ILoggerFactory loggerFactory)
Constructor.
Properties
LoggerFactory
Property
Logger factory used to provide logger instance for entity-framework logs.
HttpContextAccessor
Property
Http context accessor.
DbContextConfigurator
Property
Methods
OnConfiguring
(DbContextOptionsBuilder) Method
OnConfiguring (DbContextOptionsBuilder options)
Call the dbContextConfigurator to configure this DbContext.
OnModelCreating
(ModelBuilder) Method
OnModelCreating (ModelBuilder builder)
AttachClone<T>
(<T>) Method
AttachClone<T> (<T> original)
Create a copy of the original object and add it to the DbContext change tracker.
SaveChangesAsync
(Boolean,CancellationToken) Method
SaveChangesAsync (Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
Save changes made in this context, after updating audit properties.
SaveChanges
SaveChanges ()
Save changes made in this context, after updating audit properties.
SaveChanges
(Boolean) Method
SaveChanges (Boolean acceptAllChangesOnSuccess)
Save changes made in this context, after updating audit properties.
Parameters
Name |
Type |
acceptAllChangesOnSuccess
|
Boolean
|
SaveChangesAsync<TEntity>
SaveChangesAsync<TEntity> ()
Save changes made in this context for the type specified by TEntity ONLY, after updating audit properties.
SaveChanges<TEntity>
SaveChanges<TEntity> ()
Save changes made in this context for the type specified by TEntity ONLY, after updating audit properties.
CurrentUserId
CurrentUserId ()
Retrieve the currently logged-on user's Id