예제 #1
0
        private OdsInstance RegisterOdsInstance(OdsFirstTimeSetupConfiguration configuration)
        {
            var existingInstance = _usersContext.OdsInstances.SingleOrDefault(x => x.Name == configuration.Name);

            if (existingInstance != null)
            {
                return(existingInstance);
            }

            var instance = new OdsInstance
            {
                InstanceType          = "Cloud",
                IsExtended            = false,
                Name                  = configuration.Name,
                Status                = CloudOdsStatus.SetupRequired.DisplayName,
                Version               = configuration.Version,
                OdsInstanceComponents = configuration.Components.Select(c => new OdsInstanceComponent
                {
                    Name    = $"{c.Name} ({c.Environment})",
                    Url     = c.Url,
                    Version = c.Version
                }).ToList()
            };

            _usersContext.OdsInstances.Add(instance);
            return(instance);
        }
예제 #2
0
        private void SetupAndRuntimeConfigurations(OdsFirstTimeSetupConfiguration firstTimeSetupConfiguration)
        {
            _cloudOdsSqlConfigurator.CreateServerLogins(firstTimeSetupConfiguration.SqlConfiguration);

            var setupConfiguration =
                _cloudOdsDatabaseSqlServerSecurityConfiguration.GetSetupConfiguration(firstTimeSetupConfiguration
                                                                                      .SqlConfiguration).ToList();

            var runtimeConfiguration =
                _cloudOdsDatabaseSqlServerSecurityConfiguration.GetRuntimeConfiguration(firstTimeSetupConfiguration
                                                                                        .SqlConfiguration);

            _cloudOdsSqlConfigurator.ApplyConfiguration(firstTimeSetupConfiguration.SqlConfiguration, setupConfiguration);
            _cloudOdsSqlConfigurator.ApplyConfiguration(firstTimeSetupConfiguration.SqlConfiguration, runtimeConfiguration);

            ExtraDatabaseInitializationAction?.Invoke();

            _cloudOdsSqlConfigurator.RemoveConfiguration(firstTimeSetupConfiguration.SqlConfiguration, setupConfiguration);
        }