/// <inheritdoc />
    public virtual async Task <TContext> CreateDbContextAsync(CancellationToken cancellationToken = default)
    {
        var lease = new DbContextLease(_pool, standalone: true);
        await lease.Context.SetLeaseAsync(lease, cancellationToken).ConfigureAwait(false);

        return((TContext)lease.Context);
    }
    /// <inheritdoc />
    public virtual TContext CreateDbContext()
    {
        var lease = new DbContextLease(_pool, standalone: true);

        lease.Context.SetLease(lease);

        return((TContext)lease.Context);
    }
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public ScopedDbContextLease(IDbContextPool <TContext> contextPool)
 {
     _lease = new DbContextLease(contextPool, standalone: false);
     _lease.Context.SetLease(_lease);
 }