Database Class

Definition

The main interaction point between a context and the database provider.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public abstract class Database : Microsoft.EntityFrameworkCore.Storage.IDatabase
type Database = class
    interface IDatabase
Public MustInherit Class Database
Implements IDatabase
Inheritance
Database
Derived
Implements

Remarks

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

See Implementation of database providers and extensions for more information and examples.

Constructors

Database(DatabaseDependencies)

Initializes a new instance of the Database class.

Database(IQueryCompilationContextFactory)

Initializes a new instance of the Database class.

Properties

Dependencies

Dependencies for this service.

Methods

CompileAsyncQuery<TResult>(QueryModel)

Translates a query model into a function that can be executed to asynchronously get query results from the database.

CompileQuery<TResult>(Expression, Boolean)

Compiles the given query to generate a Func<T,TResult>.

CompileQuery<TResult>(QueryModel)

Translates a query model into a function that can be executed to get query results from the database.

SaveChanges(IList<IUpdateEntry>)

Persists changes from the supplied entries to the database.

SaveChanges(IReadOnlyList<IUpdateEntry>)

Persists changes from the supplied entries to the database.

SaveChangesAsync(IList<IUpdateEntry>, CancellationToken)

Asynchronously persists changes from the supplied entries to the database.

SaveChangesAsync(IReadOnlyList<IUpdateEntry>, CancellationToken)

Asynchronously persists changes from the supplied entries to the database.

Applies to