Owneat Technical Guide main Help

Class UserContext

Namespace: Identity.Infrastructure.Persistence
Assembly: Identity.Infrastructure.dll

Database context class for managing users.

public sealed class UserContext : DbContext, IInfrastructure<IServiceProvider>, IDbContextDependencies, IDbSetCache, IDbContextPoolable, IResettableService, IDisposable, IAsyncDisposable

Inheritance

objectDbContext ← UserContext

Implements

IInfrastructure<IServiceProvider\>, IDbContextDependencies, IDbSetCache, IDbContextPoolable, IResettableService, IDisposable, IAsyncDisposable

Inherited Members

DbContext.Set<TEntity\>\(\), DbContext.Set<TEntity\>\(string\), DbContext.SaveChanges\(\), DbContext.SaveChanges\(bool\), DbContext.SaveChangesAsync\(CancellationToken\), DbContext.SaveChangesAsync\(bool, CancellationToken\), DbContext.Dispose\(\), DbContext.DisposeAsync\(\), DbContext.Entry<TEntity\>\(TEntity\), DbContext.Entry\(object\), DbContext.Add<TEntity\>\(TEntity\), DbContext.AddAsync<TEntity\>\(TEntity, CancellationToken\), DbContext.Attach<TEntity\>\(TEntity\), DbContext.Update<TEntity\>\(TEntity\), DbContext.Remove<TEntity\>\(TEntity\), DbContext.Add\(object\), DbContext.AddAsync\(object, CancellationToken\), DbContext.Attach\(object\), DbContext.Update\(object\), DbContext.Remove\(object\), DbContext.AddRange\(params object\[\]\), DbContext.AddRangeAsync\(params object\[\]\), DbContext.AttachRange\(params object\[\]\), DbContext.UpdateRange\(params object\[\]\), DbContext.RemoveRange\(params object\[\]\), DbContext.AddRange\(IEnumerable<object\>\), DbContext.AddRangeAsync\(IEnumerable<object\>, CancellationToken\), DbContext.AttachRange\(IEnumerable<object\>\), DbContext.UpdateRange\(IEnumerable<object\>\), DbContext.RemoveRange\(IEnumerable<object\>\), DbContext.Find\(Type, params object?\[\]?\), DbContext.FindAsync\(Type, params object?\[\]?\), DbContext.FindAsync\(Type, object?\[\]?, CancellationToken\), DbContext.Find<TEntity\>\(params object?\[\]?\), DbContext.FindAsync<TEntity\>\(params object?\[\]?\), DbContext.FindAsync<TEntity\>\(object?\[\]?, CancellationToken\), DbContext.FromExpression<TResult\>\(Expression<Func<IQueryable<TResult\>\>\>\), DbContext.Database, DbContext.ChangeTracker, DbContext.Model, DbContext.ContextId, DbContext.SavingChanges, DbContext.SavedChanges, DbContext.SaveChangesFailed, object.Equals\(object?\), object.Equals\(object?, object?\), object.GetHashCode\(\), object.GetType\(\), object.ReferenceEquals\(object?, object?\), object.ToString\(\)

Constructors

UserContext\(DbContextOptions<UserContext\>, IOptions<ConnectionStrings\>\)

Class constructor.

public UserContext(DbContextOptions<UserContext> options, IOptions<ConnectionStrings> connectionStringsOptions)

Parameters

options DbContextOptions < UserContext \>

Database context options.

connectionStringsOptions IOptions < ConnectionStrings \>

Connection strings options.

Properties

Roles

Data set for user roles.

public DbSet<Role> Roles { get; set; }

Property Value

DbSet <Role\>

Users

Data set for users.

public DbSet<User> Users { get; set; }

Property Value

DbSet <User\>

Methods

OnConfiguring\(DbContextOptionsBuilder\)

Method for configuring database context options.

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

Parameters

optionsBuilder DbContextOptionsBuilder

Database context options builder.

OnModelCreating\(ModelBuilder\)

Method that execute instructions on model creation, used to auto-populate roles.

protected override void OnModelCreating(ModelBuilder modelBuilder)

Parameters

modelBuilder ModelBuilder

Last modified: 21 May 2024