Share via


InMemoryDatabaseFacadeExtensions.IsInMemory(DatabaseFacade) Method

Definition

Returns true if the database provider currently in use is the in-memory provider.

public static bool IsInMemory (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade database);
static member IsInMemory : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade -> bool
<Extension()>
Public Function IsInMemory (database As DatabaseFacade) As Boolean

Parameters

database
DatabaseFacade

The facade from Database.

Returns

true if the in-memory database is being used.

Remarks

This method can only be used after the DbContext has been configured because it is only then that the provider is known. This means that this method cannot be used in OnConfiguring(DbContextOptionsBuilder) because this is where application code sets the provider to use as part of configuring the context.

See The EF Core in-memory database provider for more information and examples.

Applies to