Esempio n. 1
0
        // ReSharper disable once MemberCanBePrivate.Global
        public async Task CreateSystemDatabaseAsync()
        {
            if (await IsSystemDatabaseExistingAsync())
            {
                throw new DatabaseException("System database already exists.");
            }

            try
            {
                await _repositoryClient.CreateRepositoryAsync(_systemConfiguration.SystemDatabaseName);

                using var systemSession = await OspSystemDatabase.StartSessionAsync();

                systemSession.StartTransaction();

                await CreateSystemSchemaAsync(systemSession);

                UnloadAllCaches();

                await systemSession.CommitTransactionAsync();
            }
            catch (Exception)
            {
                await _repositoryClient.DropRepositoryAsync(_systemConfiguration.SystemDatabaseName);

                throw;
            }
        }