DbContext Class
Namespace: Nucleus.Data.EntityFramework
Assembly: Nucleus.Data.EntityFramework.dll
Entity-framework dbcontext implementation.
Constructor
DbContext
(DbContextConfigurator, IHttpContextAccessor, ILoggerFactory) Constructor
DbContext (DbContextConfigurator dbContextConfigurator, IHttpContextAccessor httpContextAccessor, ILoggerFactory loggerFactory)
Constructor.
Properties
ConfigureNucleusEntities
Property
Get or set whether Nucleus entities should be configured in OnModelCreating.
DbContextConfigurator
Property
HttpContextAccessor
Property
Http context accessor.
LoggerFactory
Property
Logger factory used to provide logger instance for entity-framework logs.
Methods
AttachClone<T>
(<T>) Method
AttachClone<T> (<T> original)
Create a shallow copy of the original object and add it to the DbContext change tracker.
ConfigureConventions
(ModelConfigurationBuilder) Method
ConfigureConventions (ModelConfigurationBuilder configurationBuilder)
Apply model conventions which apply to all entities.
CurrentUserId
CurrentUserId ()
Retrieve the currently logged-on user's Id
ManageSpecialColumns
ManageSpecialColumns ()
Automatically set properties of entity framework entries before adding or updating the database.
OnConfiguring
(DbContextOptionsBuilder) Method
OnConfiguring (DbContextOptionsBuilder options)
Call the dbContextConfigurator to configure this DbContext.
OnModelCreating
(ModelBuilder) Method
OnModelCreating (ModelBuilder builder)
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
|
SaveChanges<TEntity>
SaveChanges<TEntity> ()
Save changes made in this context for the type specified by TEntity ONLY, after updating audit properties.
SaveChangesAsync
(Boolean, CancellationToken) Method
SaveChangesAsync (Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
Save changes made in this context, after updating audit properties.
SaveChangesAsync<TEntity>
SaveChangesAsync<TEntity> ()
Save changes made in this context for the type specified by TEntity ONLY, after updating audit properties.