InMemoryDbContextOptionsExtensions InMemoryDbContextOptionsExtensions Class

Definition

In-memory specific extension methods for DbContextOptionsBuilder.

public static class InMemoryDbContextOptionsExtensions
Public Module InMemoryDbContextOptionsExtensions
Inheritance
System.ObjectSystem.Object
InMemoryDbContextOptionsExtensionsInMemoryDbContextOptionsExtensions

Inherited Members

System.Object

System.Object.ToString()System.Object.ToString()
System.Object.Equals(System.Object)System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()System.Object.GetHashCode()
System.Object.GetType()System.Object.GetType()
System.Object.MemberwiseClone()System.Object.MemberwiseClone()

Methods

UseInMemoryDatabase(DbContextOptionsBuilder, Action) UseInMemoryDatabase(DbContextOptionsBuilder, Action(Of InMemoryDbContextOptionsBuilder))

Configures the context to connect to an in-memory database. By default, the same in-memory database instance will be shared by all instances of a given context type. To change this, use the overload that takes a database name.

public static DbContextOptionsBuilder UseInMemoryDatabase(this DbContextOptionsBuilder optionsBuilder, Action<InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = null)
<ExtensionAttribute>
Public Shared Function UseInMemoryDatabase(optionsBuilder As DbContextOptionsBuilder, inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder
Parameters
optionsBuilder
DbContextOptionsBuilder DbContextOptionsBuilder

The builder being used to configure the context.

inMemoryOptionsAction
System.Action<InMemoryDbContextOptionsBuilder> System.Action(Of InMemoryDbContextOptionsBuilder)

An optional action to allow additional in-memory specific configuration.

Returns

The options builder so that further configuration can be chained.

UseInMemoryDatabase(DbContextOptionsBuilder, String, Action) UseInMemoryDatabase(DbContextOptionsBuilder, String, Action(Of InMemoryDbContextOptionsBuilder))

Configures the context to connect to an in-memory database.

public static DbContextOptionsBuilder UseInMemoryDatabase(this DbContextOptionsBuilder optionsBuilder, string databaseName, Action<InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = null)
<ExtensionAttribute>
Public Shared Function UseInMemoryDatabase(optionsBuilder As DbContextOptionsBuilder, databaseName As String, inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder
Parameters
optionsBuilder
DbContextOptionsBuilder DbContextOptionsBuilder

The builder being used to configure the context.

databaseName
System.String System.String

The name of the in-memory database. This allows the scope of the in-memory database to be controlled independently of the context.

inMemoryOptionsAction
System.Action<InMemoryDbContextOptionsBuilder> System.Action(Of InMemoryDbContextOptionsBuilder)

An optional action to allow additional in-memory specific configuration.

Returns

The options builder so that further configuration can be chained.

UseInMemoryDatabase(DbContextOptionsBuilder, Action) UseInMemoryDatabase(Of TContext)(DbContextOptionsBuilder(Of TContext), Action(Of InMemoryDbContextOptionsBuilder))

Configures the context to connect to an in-memory database. By default, the same in-memory database instance will be shared by all instances of a given context type. To change this, use the overload that takes a database name.

public static DbContextOptionsBuilder<TContext> UseInMemoryDatabase<TContext>(this DbContextOptionsBuilder<TContext> optionsBuilder, Action<InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = null)where TContext : DbContext
<ExtensionAttribute>
Public Shared Function UseInMemoryDatabase(Of TContext As DbContext)(optionsBuilder As DbContextOptionsBuilder(Of TContext), inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)
Type Parameters
TContext

The type of context being configured.

Parameters
optionsBuilder
DbContextOptionsBuilder<TContext> DbContextOptionsBuilder(Of TContext)

The builder being used to configure the context.

inMemoryOptionsAction
System.Action<InMemoryDbContextOptionsBuilder> System.Action(Of InMemoryDbContextOptionsBuilder)

An optional action to allow additional in-memory specific configuration.

Returns

The options builder so that further configuration can be chained.

UseInMemoryDatabase(DbContextOptionsBuilder, String, Action) UseInMemoryDatabase(Of TContext)(DbContextOptionsBuilder(Of TContext), String, Action(Of InMemoryDbContextOptionsBuilder))

Configures the context to connect to an in-memory database.

public static DbContextOptionsBuilder<TContext> UseInMemoryDatabase<TContext>(this DbContextOptionsBuilder<TContext> optionsBuilder, string databaseName, Action<InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = null)where TContext : DbContext
<ExtensionAttribute>
Public Shared Function UseInMemoryDatabase(Of TContext As DbContext)(optionsBuilder As DbContextOptionsBuilder(Of TContext), databaseName As String, inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)
Type Parameters
TContext

The type of context being configured.

Parameters
optionsBuilder
DbContextOptionsBuilder<TContext> DbContextOptionsBuilder(Of TContext)

The builder being used to configure the context.

databaseName
System.String System.String

The name of the in-memory database. This allows the scope of the in-memory database to be controlled independently of the context.

inMemoryOptionsAction
System.Action<InMemoryDbContextOptionsBuilder> System.Action(Of InMemoryDbContextOptionsBuilder)

An optional action to allow additional in-memory specific configuration.

Returns

The options builder so that further configuration can be chained.