Class TenantDBContext
- Namespace
- Oqtane.Repository
- Assembly
- Oqtane.Server.dll
public class TenantDBContext : IdentityUserContext<IdentityUser>
- Inheritance
-
objectDbContextIdentityUserContext<IdentityUser, string, IdentityUserClaim<string>, IdentityUserLogin<string>, IdentityUserToken<string>, IdentityUserPasskey<string>>IdentityUserContext<IdentityUser, string, IdentityUserClaim<string>, IdentityUserLogin<string>, IdentityUserToken<string>>IdentityUserContext<IdentityUser, string>IdentityUserContext<IdentityUser>TenantDBContext
Constructors
TenantDBContext(DbContextOptions<TenantDBContext>, IDBContextDependencies)
public TenantDBContext(DbContextOptions<TenantDBContext> options, IDBContextDependencies DBContextDependencies)
Parameters
optionsDbContextOptions<TenantDBContext>DBContextDependenciesIDBContextDependencies
Properties
ActiveDatabase
public IDatabase ActiveDatabase { get; set; }
Property Value
- IDatabase
File
public virtual DbSet<File> File { get; set; }
Property Value
- DbSet<File>
Folder
public virtual DbSet<Folder> Folder { get; set; }
Property Value
- DbSet<Folder>
Language
public virtual DbSet<Language> Language { get; set; }
Property Value
- DbSet<Language>
Log
public virtual DbSet<Log> Log { get; set; }
Property Value
- DbSet<Log>
MigrationHistory
public virtual DbSet<MigrationHistory> MigrationHistory { get; set; }
Property Value
- DbSet<MigrationHistory>
Module
public virtual DbSet<Module> Module { get; set; }
Property Value
- DbSet<Module>
Notification
public virtual DbSet<Notification> Notification { get; set; }
Property Value
- DbSet<Notification>
Page
public virtual DbSet<Page> Page { get; set; }
Property Value
- DbSet<Page>
PageModule
public virtual DbSet<PageModule> PageModule { get; set; }
Property Value
- DbSet<PageModule>
Permission
public virtual DbSet<Permission> Permission { get; set; }
Property Value
- DbSet<Permission>
Profile
public virtual DbSet<Profile> Profile { get; set; }
Property Value
- DbSet<Profile>
Role
public virtual DbSet<Role> Role { get; set; }
Property Value
- DbSet<Role>
SearchContent
public virtual DbSet<SearchContent> SearchContent { get; set; }
Property Value
- DbSet<SearchContent>
SearchContentProperty
public virtual DbSet<SearchContentProperty> SearchContentProperty { get; set; }
Property Value
- DbSet<SearchContentProperty>
SearchContentWord
public virtual DbSet<SearchContentWord> SearchContentWord { get; set; }
Property Value
- DbSet<SearchContentWord>
SearchWord
public virtual DbSet<SearchWord> SearchWord { get; set; }
Property Value
- DbSet<SearchWord>
Setting
public virtual DbSet<Setting> Setting { get; set; }
Property Value
- DbSet<Setting>
Site
public virtual DbSet<Site> Site { get; set; }
Property Value
- DbSet<Site>
UrlMapping
public virtual DbSet<UrlMapping> UrlMapping { get; set; }
Property Value
- DbSet<UrlMapping>
User
public virtual DbSet<User> User { get; set; }
Property Value
- DbSet<User>
UserRole
public virtual DbSet<UserRole> UserRole { get; set; }
Property Value
- DbSet<UserRole>
Visitor
public virtual DbSet<Visitor> Visitor { get; set; }
Property Value
- DbSet<Visitor>
Methods
OnConfiguring(DbContextOptionsBuilder)
Override this method to configure the database (and other options) to be used for this context. This method is called for each instance of the context that is created. The base implementation does nothing.
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
Parameters
optionsBuilderDbContextOptionsBuilderA builder used to create or modify options for this context. Databases (and other extensions) typically define extension methods on this object that allow you to configure the context.
Remarks
In situations where an instance of Microsoft.EntityFrameworkCore.DbContextOptions may or may not have been passed to the constructor, you can use Microsoft.EntityFrameworkCore.DbContextOptionsBuilder.IsConfigured to determine if the options have already been set, and skip some or all of the logic in Microsoft.EntityFrameworkCore.DbContext.OnConfiguring(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder).
See DbContext lifetime, configuration, and initialization for more information and examples.
OnModelCreating(ModelBuilder)
Configures the schema needed for the identity framework.
protected override void OnModelCreating(ModelBuilder builder)
Parameters
builderModelBuilderThe builder being used to construct the model for this context.
SaveChanges()
Saves all changes made in this context to the database.
public override int SaveChanges()
Returns
- int
The number of state entries written to the database.
Remarks
This method will automatically call Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.DetectChanges() to discover any changes to entity instances before saving to the underlying database. This can be disabled via Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.AutoDetectChangesEnabled.
Entity Framework Core does not support multiple parallel operations being run on the same DbContext instance. This includes both parallel execution of async queries and any explicit concurrent use from multiple threads. Therefore, always await async calls immediately, or use separate DbContext instances for operations that execute in parallel. See Avoiding DbContext threading issues for more information and examples.
See Saving data in EF Core for more information and examples.
Exceptions
- DbUpdateException
An error is encountered while saving to the database.
- DbUpdateConcurrencyException
A concurrency violation is encountered while saving to the database. A concurrency violation occurs when an unexpected number of rows are affected during save. This is usually because the data in the database has been modified since it was loaded into memory.
SaveChangesAsync(CancellationToken)
Saves all changes made in this context to the database.
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA System.Threading.CancellationToken to observe while waiting for the task to complete.
Returns
- Task<int>
A task that represents the asynchronous save operation. The task result contains the number of state entries written to the database.
Remarks
This method will automatically call Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.DetectChanges() to discover any changes to entity instances before saving to the underlying database. This can be disabled via Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.AutoDetectChangesEnabled.
Entity Framework Core does not support multiple parallel operations being run on the same DbContext instance. This includes both parallel execution of async queries and any explicit concurrent use from multiple threads. Therefore, always await async calls immediately, or use separate DbContext instances for operations that execute in parallel. See Avoiding DbContext threading issues for more information and examples.
See Saving data in EF Core for more information and examples.
Exceptions
- DbUpdateException
An error is encountered while saving to the database.
- DbUpdateConcurrencyException
A concurrency violation is encountered while saving to the database. A concurrency violation occurs when an unexpected number of rows are affected during save. This is usually because the data in the database has been modified since it was loaded into memory.
- OperationCanceledException
If the System.Threading.CancellationToken is canceled.