IDatabase IDatabase Interface

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

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

Syntax

Declaration

public interface IDatabasePublic Interface IDatabase

Methods summary

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

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

Persists changes from the supplied entries to the database.

Asynchronously persists changes from the supplied entries to the database.

Methods

  • CompileAsyncQuery<TResult>(QueryModel)
    CompileAsyncQuery(Of TResult)(QueryModel)

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

    Func<QueryContext, IAsyncEnumerable<TResult>> CompileAsyncQuery<TResult>(QueryModel queryModel)Function CompileAsyncQuery(Of TResult)(queryModel As QueryModel) As Func(Of QueryContext, IAsyncEnumerable(Of TResult))

    Parameters

    • queryModel
      QueryModel
      QueryModel

      An object model representing the query to be executed.

    Returns

    • System.Func<T, TResult><QueryContext, IAsyncEnumerable<><TResult>>
      System.Func<T, TResult>(Of QueryContext, IAsyncEnumerable<>(Of TResult))

      A function that will asynchronously execute the query.

  • CompileQuery<TResult>(QueryModel)
    CompileQuery(Of TResult)(QueryModel)

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

    Func<QueryContext, IEnumerable<TResult>> CompileQuery<TResult>(QueryModel queryModel)Function CompileQuery(Of TResult)(queryModel As QueryModel) As Func(Of QueryContext, IEnumerable(Of TResult))

    Parameters

    • queryModel
      QueryModel
      QueryModel

      An object model representing the query to be executed.

    Returns

    • System.Func<T, TResult><QueryContext, System.Collections.Generic.IEnumerable<T><TResult>>
      System.Func<T, TResult>(Of QueryContext, System.Collections.Generic.IEnumerable<T>(Of TResult))

      A function that will execute the query.

  • SaveChanges(IReadOnlyList<IUpdateEntry>)
    SaveChanges(IReadOnlyList(Of IUpdateEntry))

    Persists changes from the supplied entries to the database.

    int SaveChanges(IReadOnlyList<IUpdateEntry> entries)Function SaveChanges(entries As IReadOnlyList(Of IUpdateEntry)) As Integer

    Parameters

    • entries
      System.Collections.Generic.IReadOnlyList<T><IUpdateEntry>
      System.Collections.Generic.IReadOnlyList<T>(Of IUpdateEntry)

      Entries representing the changes to be persisted.

    Returns

    • System.Int32
      System.Int32

      The number of state entries persisted to the database.

  • SaveChangesAsync(IReadOnlyList<IUpdateEntry>, CancellationToken)
    SaveChangesAsync(IReadOnlyList(Of IUpdateEntry), CancellationToken)

    Asynchronously persists changes from the supplied entries to the database.

    Task<int> SaveChangesAsync(IReadOnlyList<IUpdateEntry> entries, CancellationToken cancellationToken = null)Function SaveChangesAsync(entries As IReadOnlyList(Of IUpdateEntry), cancellationToken As CancellationToken = Nothing) As Task(Of Integer)

    Parameters

    • entries
      System.Collections.Generic.IReadOnlyList<T><IUpdateEntry>
      System.Collections.Generic.IReadOnlyList<T>(Of IUpdateEntry)

      Entries representing the changes to be persisted.

    • cancellationToken
      System.Threading.CancellationToken
      System.Threading.CancellationToken

      A System.Threading.CancellationToken to observe while waiting for the task to complete.

    Returns

    • System.Threading.Tasks.Task<TResult><System.Int32>
      System.Threading.Tasks.Task<TResult>(Of System.Int32)

      A task that represents the asynchronous save operation. The task result contains the number of entries persisted to the database.

Details

Assembly

Microsoft.EntityFrameworkCore.dll