DbContextOptions<TContext> DbContextOptions(Of TContext) Class

Definition

The options to be used by a DbContext. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder<TContext> to create instances of this class and it is not designed to be directly constructed in your application code.

public class DbContextOptions<TContext> : DbContextOptions, IDbContextOptions where TContext : DbContext
Public Class DbContextOptions(Of TContext As DbContext)
    Inherits DbContextOptions
    Implements IDbContextOptions
Type Parameters
TContext

The type of the context these options apply to.

Inheritance
System.ObjectSystem.Object
DbContextOptions<TContext>DbContextOptions(Of TContext)
Implements

Constructors

DbContextOptions() DbContextOptions()

Initializes a new instance of the DbContextOptions<TContext> class. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder<TContext> to create instances of this class and it is not designed to be directly constructed in your application code.

public DbContextOptions()
Public Sub New

DbContextOptions(IReadOnlyDictionary) DbContextOptions(IReadOnlyDictionary(Of Type, IDbContextOptionsExtension))

Initializes a new instance of the DbContextOptions<TContext> class. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder<TContext> to create instances of this class and it is not designed to be directly constructed in your application code.

public DbContextOptions(IReadOnlyDictionary<Type, IDbContextOptionsExtension> extensions)
Public Sub New(extensions As IReadOnlyDictionary(Of Type, IDbContextOptionsExtension))
Parameters
extensions
System.Collections.Generic.IReadOnlyDictionary<System.Type, IDbContextOptionsExtension> System.Collections.Generic.IReadOnlyDictionary(Of System.Type, IDbContextOptionsExtension)

The extensions that store the configured options.

Properties

ContextType ContextType

The type of context that these options are for (TContext).

public override Type ContextType { get; }
Public Overrides ReadOnly Property ContextType As Type
Value
System.Type System.Type
Overrides

Extensions Extensions

Gets the extensions that store the configured options.

(Inherited from DbContextOptions)

Methods

Equals(Object) Equals(Object)

Inherited from System.Object

Equals(Object, Object) Equals(Object, Object)

Inherited from System.Object

FindExtension() FindExtension(Of TExtension)()

Gets the extension of the specified type. Returns null if no extension of the specified type is configured.

(Inherited from DbContextOptions)

GetExtension() GetExtension(Of TExtension)()

Gets the extension of the specified type. Throws if no extension of the specified type is configured.

(Inherited from DbContextOptions)

GetHashCode() GetHashCode()

Inherited from System.Object

GetType() GetType()

Inherited from System.Object

MemberwiseClone() MemberwiseClone()

Inherited from System.Object

ReferenceEquals(Object, Object) ReferenceEquals(Object, Object)

Inherited from System.Object

ToString() ToString()

Inherited from System.Object

WithExtension(TExtension) WithExtension(Of TExtension)(TExtension)

Adds the given extension to the options.

public override DbContextOptions WithExtension<TExtension>(TExtension extension)where TExtension : class, IDbContextOptionsExtension
Public Overrides Function WithExtension(Of TExtension As {Class, IDbContextOptionsExtension})(extension As TExtension) As DbContextOptions
Type Parameters
TExtension

The type of extension to be added.

Parameters
extension
TExtension TExtension

The extension to be added.

Returns

The same options instance so that multiple calls can be chained.

Overrides
Microsoft.EntityFrameworkCore.DbContextOptions.WithExtension<TExtension>(TExtension)Microsoft.EntityFrameworkCore.DbContextOptions.WithExtension<TExtension>(TExtension)