Database 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 : IDatabase
Public MustInherit Class Database
Implements IDatabase
- Inheritance
-
System.ObjectSystem.ObjectDatabaseDatabase
- Implements
Constructors
Database(IQueryCompilationContextFactory) Database(IQueryCompilationContextFactory)
Initializes a new instance of the Database class.
protected Database(IQueryCompilationContextFactory queryCompilationContextFactory)
Protected Sub New(queryCompilationContextFactory As IQueryCompilationContextFactory)
- queryCompilationContextFactory
- IQueryCompilationContextFactory IQueryCompilationContextFactory
Factory for compilation contexts to process LINQ queries.
Methods
CompileAsyncQuery(QueryModel)
CompileAsyncQuery(Of TResult)(QueryModel)
Translates a query model into a function that can be executed to asynchronously get query results from the database.
public virtual Func<QueryContext, IAsyncEnumerable<TResult>> CompileAsyncQuery<TResult>(QueryModel queryModel)
Public Overridable Function CompileAsyncQuery(Of TResult)(queryModel As QueryModel) As Func(Of QueryContext, IAsyncEnumerable(Of TResult))
- TResult
The type of results returned by the query.
- queryModel
- QueryModel QueryModel
An object model representing the query to be executed.
A function that will asynchronously execute the query.
CompileQuery(QueryModel)
CompileQuery(Of TResult)(QueryModel)
Translates a query model into a function that can be executed to get query results from the database.
public virtual Func<QueryContext, IEnumerable<TResult>> CompileQuery<TResult>(QueryModel queryModel)
Public Overridable Function CompileQuery(Of TResult)(queryModel As QueryModel) As Func(Of QueryContext, IEnumerable(Of TResult))
- TResult
The type of results returned by the query.
- queryModel
- QueryModel QueryModel
An object model representing the query to be executed.
A function that will execute the query.
SaveChanges(IReadOnlyList)
SaveChanges(IReadOnlyList(Of IUpdateEntry))
Persists changes from the supplied entries to the database.
public abstract int SaveChanges(IReadOnlyList<IUpdateEntry> entries)
Public MustOverride Function SaveChanges(entries As IReadOnlyList(Of IUpdateEntry)) As Integer
- entries
- System.Collections.Generic.IReadOnlyList<IUpdateEntry> System.Collections.Generic.IReadOnlyList(Of IUpdateEntry)
Entries representing the changes to be persisted.
The number of state entries persisted to the database.
SaveChangesAsync(IReadOnlyList, CancellationToken)
SaveChangesAsync(IReadOnlyList(Of IUpdateEntry), CancellationToken)
Asynchronously persists changes from the supplied entries to the database.
public abstract Task<int> SaveChangesAsync(IReadOnlyList<IUpdateEntry> entries, CancellationToken cancellationToken = null)
Public MustOverride Function SaveChangesAsync(entries As IReadOnlyList(Of IUpdateEntry), cancellationToken As CancellationToken = Nothing) As Task(Of Integer)
- entries
- System.Collections.Generic.IReadOnlyList<IUpdateEntry> System.Collections.Generic.IReadOnlyList(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.
A task that represents the asynchronous save operation. The task result contains the number of entries persisted to the database.