UseInMemoryDatabase(DbContextOptionsBuilder, String, Action<InMemoryDbContextOptionsBuilder>)

設定內容以連線到具名記憶體內部資料庫。 記憶體內部資料庫會在使用相同名稱的任何位置共用,但僅適用于指定的服務提供者。 若要跨服務提供者使用相同的記憶體內部資料庫,請呼叫 UseInMemoryDatabase(DbContextOptionsBuilder, String, InMemoryDatabaseRoot, Action<InMemoryDbContextOptionsBuilder>) 將共用 InMemoryDatabaseRoot 傳遞給資料庫的根目錄。

UseInMemoryDatabase(DbContextOptionsBuilder, String, InMemoryDatabaseRoot, Action<InMemoryDbContextOptionsBuilder>)

設定內容以連線到具名記憶體內部資料庫。 記憶體內部資料庫會在使用相同名稱的任何位置共用,但僅適用于指定的服務提供者。

UseInMemoryDatabase<TContext>(DbContextOptionsBuilder<TContext>, String, Action<InMemoryDbContextOptionsBuilder>)

設定內容以連線到記憶體內部資料庫。 記憶體內部資料庫會在使用相同名稱的任何位置共用,但僅適用于指定的服務提供者。 若要跨服務提供者使用相同的記憶體內部資料庫,請呼叫 UseInMemoryDatabase<TContext>(DbContextOptionsBuilder<TContext>, String, InMemoryDatabaseRoot, Action<InMemoryDbContextOptionsBuilder>) 將共用 InMemoryDatabaseRoot 傳遞給資料庫的根目錄。

UseInMemoryDatabase<TContext>(DbContextOptionsBuilder<TContext>, String, InMemoryDatabaseRoot, Action<InMemoryDbContextOptionsBuilder>)

設定內容以連線到記憶體內部資料庫。 記憶體內部資料庫會在使用相同名稱的任何位置共用,但僅適用于指定的服務提供者。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseInMemoryDatabase (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default);
[System.Obsolete("Use UseInMemoryDatabase(string) instead. The database will be shared anywhere the same name is used.")]
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseInMemoryDatabase (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default);
[System.Obsolete("Use UseInMemoryDatabase(string, InMemoryDatabaseRoot) instead.")]
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseInMemoryDatabase (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default);
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
[<System.Obsolete("Use UseInMemoryDatabase(string) instead. The database will be shared anywhere the same name is used.")>]
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
[<System.Obsolete("Use UseInMemoryDatabase(string, InMemoryDatabaseRoot) instead.")>]
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseInMemoryDatabase (optionsBuilder As DbContextOptionsBuilder, Optional inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder
記憶體內部資料庫會在使用相同名稱的任何位置共用,但僅適用于指定的服務提供者。 若要跨服務提供者使用相同的記憶體內部資料庫,請呼叫 UseInMemoryDatabase(DbContextOptionsBuilder, String, InMemoryDatabaseRoot, Action<InMemoryDbContextOptionsBuilder>) 將共用 InMemoryDatabaseRoot 傳遞給資料庫的根目錄。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseInMemoryDatabase (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default);
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseInMemoryDatabase (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder>? inMemoryOptionsAction = default);
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseInMemoryDatabase (optionsBuilder As DbContextOptionsBuilder, databaseName As String, Optional inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseInMemoryDatabase (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string databaseName, Microsoft.EntityFrameworkCore.Storage.InMemoryDatabaseRoot databaseRoot, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default);
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseInMemoryDatabase (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string databaseName, Microsoft.EntityFrameworkCore.Storage.InMemoryDatabaseRoot? databaseRoot, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder>? inMemoryOptionsAction = default);
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * string * Microsoft.EntityFrameworkCore.Storage.InMemoryDatabaseRoot * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseInMemoryDatabase (optionsBuilder As DbContextOptionsBuilder, databaseName As String, databaseRoot As InMemoryDatabaseRoot, Optional inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder
這個方法已過時。 請改用 UseInMemoryDatabase<TContext>(DbContextOptionsBuilder<TContext>, String, Action<InMemoryDbContextOptionsBuilder>)

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseInMemoryDatabase<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
[System.Obsolete("Use UseInMemoryDatabase(string) instead. The database will be shared anywhere the same name is used.")]
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseInMemoryDatabase<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
[System.Obsolete("Use UseInMemoryDatabase(string, InMemoryDatabaseRoot) instead.")]
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseInMemoryDatabase<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
[<System.Obsolete("Use UseInMemoryDatabase(string) instead. The database will be shared anywhere the same name is used.")>]
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
[<System.Obsolete("Use UseInMemoryDatabase(string, InMemoryDatabaseRoot) instead.")>]
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseInMemoryDatabase(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), Optional inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)
TContext 記憶體內部資料庫會在使用相同名稱的任何位置共用,但僅適用于指定的服務提供者。 若要跨服務提供者使用相同的記憶體內部資料庫,請呼叫 UseInMemoryDatabase<TContext>(DbContextOptionsBuilder<TContext>, String, InMemoryDatabaseRoot, Action<InMemoryDbContextOptionsBuilder>) 將共用 InMemoryDatabaseRoot 傳遞給資料庫的根目錄。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseInMemoryDatabase<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseInMemoryDatabase<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder>? inMemoryOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseInMemoryDatabase(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), databaseName As String, Optional inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)
TContext
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseInMemoryDatabase<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string databaseName, Microsoft.EntityFrameworkCore.Storage.InMemoryDatabaseRoot databaseRoot, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseInMemoryDatabase<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string databaseName, Microsoft.EntityFrameworkCore.Storage.InMemoryDatabaseRoot? databaseRoot, Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder>? inMemoryOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseInMemoryDatabase : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * string * Microsoft.EntityFrameworkCore.Storage.InMemoryDatabaseRoot * Action<Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseInMemoryDatabase(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), databaseName As String, databaseRoot As InMemoryDatabaseRoot, Optional inMemoryOptionsAction As Action(Of InMemoryDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)
TContext