private void RegisterUnitOfWork(IUnitOfWorkBaseAsync uow)
        {
            if (uow == null)
            {
                throw new ArgumentNullException(nameof(uow));
            }

            Logger?.LogTrace("Registering UnitOfWork ({uow.id}, {uow.type}) in {dbCtx.type}...", uow.UowId, uow.GetType(), this.GetType());

            ThrowIfDisposingOrDisposed();

            this.UowsById.Add(uow);

            OnUnitOfWorkAdded(uow);
            this.IsBusy = !this.UowsById.IsEmpty;
        }
        /// <summary>
        /// Unregisters the provided UnitOfWork instance
        /// </summary>
        /// <param name="uow"></param>
        protected internal void UnregisterUnitOfWork(IUnitOfWorkBaseAsync uow)
        {
            if (uow == null)
            {
                throw new ArgumentNullException(nameof(uow));
            }

            Logger?.LogTrace("Unregistering UnitOfWork ({uow.id}, {uow.type}) in {dbCtx.type}...", uow.UowId, uow.GetType(), this.GetType());

            //ThrowIfDisposingOrDisposed();

            if (this.UowsById.TryRemove(uow.UowId, out var removedUow))
            {
                if (!object.ReferenceEquals(uow, removedUow))
                {
                    throw new ArgumentException($"Unit of work instance removed by Id {uow.UowId} not equals the given instance!");
                }

                Logger?.LogTrace("UnitOfWork ({uow.id}, {uow.type}) removed from {dbCtx.type}.", uow.UowId, uow.GetType(), this.GetType());

                OnUnitOfWorkRemoved(uow);
                this.IsBusy = !this.UowsById.IsEmpty;
            }
        }
 /// <summary>
 /// Method that is called after a UnitOfWork is added
 /// </summary>
 /// <param name="uow">The added UnitOfWork instance</param>
 protected virtual void OnUnitOfWorkAdded(IUnitOfWorkBaseAsync uow)
 {
 }