public List <LocalEducationAgencyModel> Execute(string instanceName, ApiMode apiMode)
 {
     using (var sqlConnection = _databaseConnectionProvider.CreateNewConnection(instanceName, apiMode))
     {
         return(sqlConnection.Query <LocalEducationAgencyModel>(Query).ToList());
     }
 }
예제 #2
0
        public static Color GetModeColor(ApiMode mode)
        {
            switch (mode)
            {
            case ApiMode.Bicycle:
                return((Color)Application.Current.Resources[Constants.BikeColorName]);

            case ApiMode.Bus:
                return((Color)Application.Current.Resources[Constants.BusColorName]);

            case ApiMode.Ferry:
                return((Color)Application.Current.Resources[Constants.FerryColorName]);

            case ApiMode.Rail:
                return((Color)Application.Current.Resources[Constants.TrainColorName]);

            case ApiMode.Subway:
                return((Color)Application.Current.Resources[Constants.MetroColorName]);

            case ApiMode.Tram:
                return((Color)Application.Current.Resources[Constants.TramColorName]);

            case ApiMode.Walk:
                return((Color)Application.Current.Resources[Constants.WalkColorName]);

            default:
                return(Colors.White);
            }
        }
 public string Execute(string instanceName, ApiMode apiMode, int localEducationAgencyId)
 {
     using (var sqlConnection = _databaseConnectionProvider.CreateNewConnection(instanceName, apiMode))
     {
         return(sqlConnection.Query <string>(Query, new { LEAid = localEducationAgencyId }).Single());
     }
 }
예제 #4
0
        public async Task Execute(string odsInstanceName, CloudOdsClaimSet claimSet, ApiMode apiMode)
        {
            var odsSqlConfiguration = await _odsSecretConfigurationProvider.GetSqlConfiguration();

            var cloudOdsInstance = await _getCloudOdsInstanceQuery.Execute(odsInstanceName);

            var firstTimeSetupConfiguration = await GetFirstTimeSetupConfiguration(cloudOdsInstance, claimSet, odsSqlConfiguration);

            SetupAndRuntimeConfigurations(firstTimeSetupConfiguration);

            if (apiMode.SupportsSingleInstance)
            {
                var defaultOdsInstance = new OdsInstanceRegistration
                {
                    Name        = odsInstanceName,
                    Description = "Default single ods instance"
                };
                await _odsInstanceFirstTimeSetupService.CompleteSetup(defaultOdsInstance, claimSet, apiMode);
            }

            CreateClaimSetForAdminApp(firstTimeSetupConfiguration.ClaimSet);

            ApplyAdditionalClaimSetModifications();

            await _usersContext.SaveChangesAsync();

            await _securityContext.SaveChangesAsync();

            await _restartAppServicesCommand.Execute(new CloudOdsApiOperationContext(cloudOdsInstance));
        }
 public ReportsConfig Create(string odsInstanceName, ApiMode apiMode)
 {
     return(new ReportsConfig
     {
         ConnectionString = _connectionStringService.GetConnectionString(odsInstanceName, apiMode),
         ScriptFolder = DatabaseProviderHelper.PgSqlProvider ? "Reports.PgSql" : "Reports.Sql"
     });
 }
예제 #6
0
        public RegisterOdsInstanceModelValidator(AdminAppDbContext database
                                                 , ICloudOdsAdminAppSettingsApiModeProvider apiModeProvider
                                                 , IDatabaseValidationService databaseValidationService
                                                 , IDatabaseConnectionProvider databaseConnectionProvider
                                                 , bool validationMessageWithDetails = false)
        {
            _database = database;
            _databaseValidationService  = databaseValidationService;
            _databaseConnectionProvider = databaseConnectionProvider;
            var requiredNumericSuffixMessage = "'ODS Instance District / EdOrg Id' must not be empty.";
            var inRangeMessage        = "'ODS Instance District / EdOrg Id' must be a valid positive integer.";
            var maxValue              = int.MaxValue;
            var minValue              = 1;
            var beUniqueValidationMsg = "Education Organization / District Id";

            _mode = apiModeProvider.GetApiMode();

            if (_mode == ApiMode.YearSpecific)
            {
                requiredNumericSuffixMessage = "'ODS Instance School Year' must not be empty.";
                maxValue              = 2099;
                inRangeMessage        = "'ODS Instance School Year' must be between 1900 and 2099.";
                beUniqueValidationMsg = "school year";
                minValue              = 1900;
            }

            RuleFor(m => m.NumericSuffix).NotEmpty().WithMessage(requiredNumericSuffixMessage);

            RuleFor(m => m.NumericSuffix)
            .Must(BeWithinApplicationNameMaxLength)
            .When(x => x.NumericSuffix != null);

            RuleFor(m => m.NumericSuffix)
            .Must(x => x <= maxValue && x >= minValue)
            .When(x => x.NumericSuffix != null)
            .WithMessage(inRangeMessage);

            RuleFor(m => m.NumericSuffix)
            .Must(BeAUniqueInstanceName)
            .When(x => x.NumericSuffix != null)
            .WithMessage(
                x => $"An instance for this {beUniqueValidationMsg}{(validationMessageWithDetails ? $"({x.NumericSuffix})":"")} already exists.");

            RuleFor(m => m.NumericSuffix)
            .Must(BeValidOdsInstanceDatabase)
            .When(x => x.NumericSuffix != null)
            .WithMessage(
                x => $"Could not connect to an ODS instance database for this {beUniqueValidationMsg}{(validationMessageWithDetails ? $"({x.NumericSuffix})":"")}.");

            RuleFor(m => m.Description).NotEmpty();

            RuleFor(m => m.Description)
            .Must(BeAUniqueInstanceDescription)
            .When(x => x.Description != null)
            .WithMessage(
                x => $"An instance with this description{(validationMessageWithDetails ? $"({beUniqueValidationMsg}: {x.NumericSuffix}, Description: {x.Description})":"")} already exists.");
        }
예제 #7
0
        private static void TransitModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var _this = d as TripPlanTransitIcon;

            if (_this == null)
            {
                return;
            }

            if (!(e.NewValue is ApiMode))
            {
                return;
            }

            ApiMode newMode = (ApiMode)e.NewValue;

            switch (newMode)
            {
            case ApiMode.Bicycle:
                _this.TransitModeIcon.Foreground = (Brush)Application.Current.Resources[Constants.BikeBrushName];
                _this.TransitModeIcon.Glyph      = FontIconGlyphs.BikeIcon;
                break;

            case ApiMode.Bus:
                _this.TransitModeIcon.Foreground = (Brush)Application.Current.Resources[Constants.BusBrushName];
                _this.TransitModeIcon.Glyph      = FontIconGlyphs.BusIcon;
                break;

            case ApiMode.Ferry:
                _this.TransitModeIcon.Foreground = (Brush)Application.Current.Resources[Constants.FerryBrushName];
                _this.TransitModeIcon.Glyph      = FontIconGlyphs.FerryIcon;
                break;

            case ApiMode.Rail:
                _this.TransitModeIcon.Foreground = (Brush)Application.Current.Resources[Constants.TrainBrushName];
                _this.TransitModeIcon.Glyph      = FontIconGlyphs.TrainIcon;
                break;

            case ApiMode.Subway:
                _this.TransitModeIcon.Foreground = (Brush)Application.Current.Resources[Constants.MetroBrushName];
                _this.TransitModeIcon.Glyph      = FontIconGlyphs.MetroIcon;
                break;

            case ApiMode.Tram:
                _this.TransitModeIcon.Foreground = (Brush)Application.Current.Resources[Constants.TramBrushName];
                _this.TransitModeIcon.Glyph      = FontIconGlyphs.TramIcon;
                break;

            case ApiMode.Walk:
                _this.TransitModeIcon.Foreground     = (Brush)Application.Current.Resources[Constants.WalkBrushName];
                _this.TransitModeIcon.Glyph          = FontIconGlyphs.WalkIcon;
                _this.TransitModeIcon.FontFamily     = (FontFamily)Application.Current.Resources[Constants.HslPiktoNormalFontFamilyKey];
                _this.NameOrDistanceBlock.FontWeight = FontWeights.Normal;
                break;
            }
        }
        public IEnumerable <IRegisterOdsInstanceModel> FilteredRecords(
            IEnumerable <IRegisterOdsInstanceModel> dataRecords, ApiMode mode)
        {
            var newRows = dataRecords.Where(
                dataRecord => !_database.OdsInstanceRegistrations.Any(
                    previousRegister =>
                    previousRegister.Name == InferInstanceDatabaseName(dataRecord.NumericSuffix, mode)));

            return(newRows);
        }
        public async Task CompleteSetup(OdsInstanceRegistration odsInstanceRegistration, CloudOdsClaimSet claimSet,
                                        ApiMode apiMode)
        {
            await AddOdsInstanceRegistration(odsInstanceRegistration);
            await CreateAndSaveApiKeyAndSecret(odsInstanceRegistration, claimSet, apiMode);

            _reportViewsSetUp.CreateReportViews(odsInstanceRegistration.Name, apiMode);
            _firstTimeSetupService.EnsureAdminDatabaseInitialized();
            await _usersContext.SaveChangesAsync();
        }
 public IReadOnlyList <SchoolYearType> Execute(string instanceName, ApiMode apiMode)
 {
     using (var connection = _databaseConnectionProvider.CreateNewConnection(instanceName, apiMode))
     {
         return(connection.Query <SchoolYearType>(
                    @"SELECT SchoolYear, SchoolYearDescription, CurrentSchoolYear
               FROM edfi.SchoolYearType
               ORDER BY SchoolYear").ToList());
     }
 }
        public IDbConnection CreateNewConnection(string odsInstanceName, ApiMode apiMode)
        {
            var connectionString = _connectionStringService.GetConnectionString(odsInstanceName, apiMode);

            if (DatabaseProviderHelper.PgSqlProvider)
            {
                return(new NpgsqlConnection(connectionString));
            }

            return(new SqlConnection(connectionString));
        }
예제 #12
0
        public string GetConnectionString(string odsInstanceName, ApiMode apiMode)
        {
            var connectionString = _connectionStrings.ProductionOds;

            if (apiMode.SupportsMultipleInstances)
            {
                connectionString = GetModifiedConnectionString(connectionString, odsInstanceName);
            }

            return(connectionString);
        }
        public StudentRaceReport Execute(string instanceName, ApiMode apiMode, int localEducationAgencyId)
        {
            using (var sqlConnection = _connectionProvider.CreateNewConnection(instanceName, apiMode))
            {
                var studentDemographicData = sqlConnection.Query <StudentDemographicData>(Query, new { LEAid = localEducationAgencyId }).ToList();

                var localEducationAgencyName = new GetLocalEducationAgencyByIdQuery(_connectionProvider).Execute(instanceName, apiMode, localEducationAgencyId);

                return(new StudentRaceReport(studentDemographicData, localEducationAgencyName, localEducationAgencyId));
            }
        }
예제 #14
0
        public string GetConnectionString(string odsInstanceName, ApiMode apiMode)
        {
            var connectionString = ConfigurationManager.ConnectionStrings[CloudOdsDatabaseNames.ProductionOds].ConnectionString;

            if (apiMode.SupportsMultipleInstances)
            {
                connectionString = GetModifiedConnectionString(connectionString, odsInstanceName);
            }

            return(connectionString);
        }
예제 #15
0
        public void CreateReportViews(string odsInstanceName, ApiMode apiMode)
        {
            var reportConfig  = _reportsConfigProvider.Create(odsInstanceName, apiMode);
            var upgradeEngine = _upgradeEngineFactory.Create(reportConfig);
            var result        = upgradeEngine.PerformUpgrade();

            if (result.Successful)
            {
                return;
            }
            throw new Exception("Error while creating report views.", result.Error);
        }
예제 #16
0
 public bool IsValidDatabase(int odsInstanceNumericSuffix, ApiMode mode)
 {
     try
     {
         using (var odsInstanceConnection = _connectionProvider.CreateNewConnection(odsInstanceNumericSuffix, mode))
         {
             odsInstanceConnection.Open();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
예제 #17
0
        public SchoolTypeReport Execute(string instanceName, ApiMode apiMode, int localEducationAgencyId)
        {
            using (var sqlConnection = _databaseConnectionProvider.CreateNewConnection(instanceName, apiMode))
            {
                var schoolCounts = sqlConnection.Query <SchoolCount>(SchoolsCountQuery, new { LEAId = localEducationAgencyId }).ToList();

                var localEducationAgencyName = new GetLocalEducationAgencyByIdQuery(_databaseConnectionProvider).Execute(instanceName, apiMode, localEducationAgencyId);

                return(new SchoolTypeReport
                {
                    SchoolCounts = schoolCounts,
                    LocalEducationAgencyName = localEducationAgencyName,
                    LocalEducationAgencyId = localEducationAgencyId
                });
            }
        }
        public TotalEnrollmentReport Execute(string instanceName, ApiMode apiMode, int localEducationAgencyId)
        {
            using (var sqlConnection = _databaseConnectionProvider.CreateNewConnection(instanceName, apiMode))
            {
                var enrollmentCount = sqlConnection.QueryFirstOrDefault <int>(EnrollmentsCountQuery, new { LEAId = localEducationAgencyId });

                var localEducationAgencyName = new GetLocalEducationAgencyByIdQuery(_databaseConnectionProvider).Execute(instanceName, apiMode, localEducationAgencyId);

                return(new TotalEnrollmentReport
                {
                    EnrollmentCount = enrollmentCount,
                    LocalEducationAgencyName = localEducationAgencyName,
                    LocalEducationAgencyId = localEducationAgencyId
                });
            }
        }
예제 #19
0
        public SchoolYearType Execute(string instanceName, ApiMode apiMode)
        {
            using (var connection = _databaseConnectionProvider.CreateNewConnection(instanceName, apiMode))
            {
                var current = connection.Query <SchoolYearType>(
                    @"SELECT SchoolYear, SchoolYearDescription, CurrentSchoolYear
                      FROM edfi.SchoolYearType
                      WHERE CurrentSchoolYear = @CurrentSchoolYear", new { CurrentSchoolYear = true }).ToList();

                if (current.Count != 1)
                {
                    return(null);
                }

                return(current.Single());
            }
        }
예제 #20
0
        public async Task CreateAcademicBenchmarksConnectAppInAdminDatabase(ApiMode apiMode)
        {
            var applicationName     = $"{_instanceContext.Name}_{CloudsOdsAcademicBenchmarksConnectApp.ApplicationName}";
            var existingApplication = _usersContext.Applications.SingleOrDefault(x =>
                                                                                 x.ApplicationName.Equals(applicationName,
                                                                                                          StringComparison.InvariantCultureIgnoreCase));

            if (existingApplication != null)
            {
                return;
            }

            var instance = _usersContext.OdsInstances.SingleOrDefault(x =>
                                                                      x.Name.Equals(_instanceContext.Name, StringComparison.InvariantCultureIgnoreCase));

            var newApplication = new Application
            {
                ApplicationName       = applicationName,
                Vendor                = CreateCerticaVendor(),
                OdsInstance           = instance,
                ClaimSetName          = CloudsOdsAcademicBenchmarksConnectApp.DefaultClaimSet,
                OperationalContextUri = OperationalContext.DefaultOperationalContextUri
            };

            await CreateAndSaveNewApiClients(newApplication);

            if (apiMode.Equals(ApiMode.DistrictSpecific))
            {
                var edOrgId = OdsInstanceIdentityHelper.GetIdentityValue(_instanceContext.Name);
                newApplication.ApplicationEducationOrganizations =
                    new List <ApplicationEducationOrganization>
                {
                    new ApplicationEducationOrganization
                    {
                        Clients = newApplication.ApiClients,
                        EducationOrganizationId = edOrgId
                    }
                };
            }

            _usersContext.Applications.Add(newApplication);
        }
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (!(value is ApiMode))
            {
                return(false);
            }
            ApiMode mode = (ApiMode)value;

            if (mode == ApiMode.Bus ||
                mode == ApiMode.Rail ||
                mode == ApiMode.Subway ||
                mode == ApiMode.Tram ||
                mode == ApiMode.Ferry)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (!(value is ApiMode))
            {
                return(false);
            }
            ApiMode mode = (ApiMode)value;

            if (mode == ApiMode.Bus ||
                mode == ApiMode.Rail ||
                mode == ApiMode.Subway ||
                mode == ApiMode.Tram ||
                mode == ApiMode.Ferry)
            {
                return(App.Current.Resources["SystemControlBackgroundAccentBrush"]);
            }
            else
            {
                return(App.Current.Resources["SystemControlForegroundBaseHighBrush"]);
            }
        }
예제 #23
0
        public async Task Execute(string odsInstanceName, CloudOdsClaimSet claimSet, ApiMode apiMode)
        {
            ExtraDatabaseInitializationAction?.Invoke();

            if (apiMode.SupportsSingleInstance)
            {
                var defaultOdsInstance = new OdsInstanceRegistration
                {
                    Name        = odsInstanceName,
                    Description = "Default single ods instance"
                };
                await _firstTimeSetupService.CompleteSetup(defaultOdsInstance, claimSet, apiMode);
            }

            CreateClaimSetForAdminApp(claimSet);

            ApplyAdditionalClaimSetModifications();

            await _usersContext.SaveChangesAsync();

            await _securityContext.SaveChangesAsync();
        }
예제 #24
0
        public void Execute(string instanceName, ApiMode apiMode, short schoolYear)
        {
            using (var connection = _databaseConnectionProvider.CreateNewConnection(instanceName, apiMode))
            {
                // Take special care that any modifications to the SQL here fall
                // within the common subset of SQL Server and Postgres syntax.

                var rowsAffected = connection.Execute(
                    @"UPDATE edfi.SchoolYearType
                      SET CurrentSchoolYear = 'true'
                      WHERE SchoolYear = @schoolYear", new { schoolYear });

                if (rowsAffected == 0)
                {
                    throw new Exception($"School year {schoolYear} does not exist.");
                }

                connection.Execute(
                    @"UPDATE edfi.SchoolYearType
                      SET CurrentSchoolYear = 'false'
                      WHERE SchoolYear <> @schoolYear", new { schoolYear });
            }
        }
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (!(value is ApiMode))
            {
                return(DependencyProperty.UnsetValue);
            }

            ApiMode mode = (ApiMode)value;

            switch (mode)
            {
            case ApiMode.Bicycle:
                return(FontIconGlyphs.BikeIcon);

            case ApiMode.Bus:
                return(FontIconGlyphs.BusIcon);

            case ApiMode.Ferry:
                return(FontIconGlyphs.FerryIcon);

            case ApiMode.Rail:
                return(FontIconGlyphs.TrainIcon);

            case ApiMode.Subway:
                return(FontIconGlyphs.MetroIcon);

            case ApiMode.Tram:
                return(FontIconGlyphs.TramIcon);

            case ApiMode.Walk:
                return(FontIconGlyphs.WalkIcon);

            default:
                return(FontIconGlyphs.WalkIcon);
            }
        }
예제 #26
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (!(value is ApiMode))
            {
                return(DependencyProperty.UnsetValue);
            }

            ApiMode mode = (ApiMode)value;

            switch (mode)
            {
            case ApiMode.Bicycle:
                return(Application.Current.Resources[Constants.BikeBrushName]);

            case ApiMode.Bus:
                return(Application.Current.Resources[Constants.BusBrushName]);

            case ApiMode.Ferry:
                return(Application.Current.Resources[Constants.FerryBrushName]);

            case ApiMode.Rail:
                return(Application.Current.Resources[Constants.TrainBrushName]);

            case ApiMode.Subway:
                return(Application.Current.Resources[Constants.MetroBrushName]);

            case ApiMode.Tram:
                return(Application.Current.Resources[Constants.TramBrushName]);

            case ApiMode.Walk:
                return(Application.Current.Resources[Constants.WalkBrushName]);

            default:
                return(Application.Current.Resources[Constants.WalkBrushName]);
            }
        }
예제 #27
0
        public async Task <IActionResult> Index([FromBody] AltinnCoreApiModel model, string org, string service, string edition, int instanceId, ApiMode apiMode)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            ApiResult apiResult = new ApiResult();

            // Getting the Service Specific Implementation contained in external DLL migrated from TUL
            IServiceImplementation serviceImplementation = _execution.GetServiceImplementation(org, service, edition);

            // Create and populate the RequestContext object and make it available for the service implementation so
            // service developer can implement logic based on information about the request and the user performing
            // the request
            RequestContext requestContext = RequestHelper.GetRequestContext(Request.Query, 0);

            requestContext.UserContext = _userHelper.GetUserContext(HttpContext);
            requestContext.Reportee    = requestContext.UserContext.Reportee;

            // Get the serviceContext containing all metadata about current service
            ServiceContext serviceContext = _execution.GetServiceContext(org, service, edition);

            // Assign the Requestcontext and ViewBag to the serviceImplementation so
            // service developer can use the information in any of the service events that is called
            serviceImplementation.SetContext(requestContext, ViewBag, serviceContext, null, ModelState);

            // Set the platform services to the ServiceImplementation so the AltinnCore service can take
            // use of the plattform services
            PlatformServices platformServices = new PlatformServices(_authorization, _repository, _execution, org, service, edition);

            serviceImplementation.SetPlatformServices(platformServices);

            ViewBag.PlatformServices = platformServices;

            dynamic serviceModel = ParseApiBody(serviceImplementation.GetServiceModelType(), out apiResult, model);

            if (serviceModel == null)
            {
                // The parsing did not create any result
                Response.StatusCode = 403;
                return(new ObjectResult(apiResult));
            }

            serviceImplementation.SetServiceModel(serviceModel);

            // ServiceEvent 2: HandleGetDataEvent
            // Runs the event where the service developer can implement functionality to retrieve data from internal/external sources
            // based on the data in the service model
            await serviceImplementation.RunServiceEvent(ServiceEventType.DataRetrieval);

            // RunService 3: Calcuation
            await serviceImplementation.RunServiceEvent(ServiceEventType.Calculation);

            // ServiceEvent 3: HandleCalculationEvent
            // Perform Calculation defined by the service developer
            // Only perform when the mode is to create a new instance or to specific calculate
            if (apiMode.Equals(ApiMode.Calculate) || apiMode.Equals(ApiMode.Create))
            {
                if (apiMode.Equals(ApiMode.Calculate))
                {
                    // Returns a updated Service model with new calculated data.
                    return(Ok(serviceModel));
                }
            }

            // ServiceEvent 4: HandleValidationEvent
            // Perform additional Validation defined by the service developer.
            await serviceImplementation.RunServiceEvent(AltinnCore.ServiceLibrary.Enums.ServiceEventType.Validation);

            // Run the model Validation that handles validation defined on the model
            TryValidateModel(serviceModel);

            // If ApiMode is only validate the instance should not be created and only return any validation errors
            if (apiMode.Equals(ApiMode.Validate) || (!ModelState.IsValid && !apiMode.Equals(ApiMode.Create)))
            {
                MapModelStateToApiResult(ModelState, apiResult, serviceContext);

                if (apiResult.Status.Equals(ApiStatusType.ContainsError))
                {
                    if (apiMode.Equals(ApiMode.Validate))
                    {
                        Response.StatusCode = 202;
                    }
                    else
                    {
                        Response.StatusCode = 400;
                    }

                    return(new ObjectResult(apiResult));
                }

                return(Ok(apiResult));
            }


            // Save Formdata to database
            this._form.SaveFormModel(
                serviceModel,
                instanceId,
                serviceImplementation.GetServiceModelType(),
                org,
                service,
                edition,
                requestContext.UserContext.ReporteeId);

            apiResult.InstanceId = instanceId;
            apiResult.Status     = ApiStatusType.Ok;
            if (!requestContext.RequiresClientSideReleoad)
            {
                return(Ok(apiResult));
            }
            {
                Response.StatusCode = 303;
                return(new ObjectResult(apiResult));
            }
        }
예제 #28
0
 public IDbConnection CreateNewConnection(int odsInstanceNumericSuffix, ApiMode apiMode)
 {
     throw new NotImplementedException();
 }
예제 #29
0
 public IDbConnection CreateNewConnection(string odsInstanceName = "EdFi_Ods_Production", ApiMode apiMode = null)
 {
     return(new SqlConnection(ConnectionString));
 }
 private string InferInstanceDatabaseName(int?newInstanceNumericSuffix, ApiMode mode)
 {
     using (var connection = _databaseConnectionProvider.CreateNewConnection(newInstanceNumericSuffix.Value, mode))
         return(connection.Database);
 }