public TDbContext GetDbContext <TDbContext>() where TDbContext : AbpDbContext
        {
            var unitOfWork = _unitOfWorkManager.Current;

            if (unitOfWork == null)
            {
                throw new AbpException("A DbContext can only be created inside a unit of work!");
            }

            var connectionStringName = typeof(TDbContext).Name;
            var connectionString     = _connectionStringResolver.Resolve <TDbContext>();
            var dbContextKey         = $"{typeof(TDbContext).FullName}:{unitOfWork.Options.IsTransactional}:{connectionString}";
            var databaseProvider     = _connectionStringResolver.GetDatabaseProvider();
            var databaseApi          = unitOfWork.GetOrAddDatabaseApi(
                dbContextKey,
                () => new EfCoreDatabaseApi <TDbContext>(
                    CreateDbContext <TDbContext>(unitOfWork, connectionStringName, connectionString, databaseProvider)
                    ));

            return(((EfCoreDatabaseApi <TDbContext>)databaseApi).DbContext);
        }