public void UpdateFirstTimeSetUpStatus(bool setUpCompleted)
        {
            var config = _database.EnsureSingle <ApplicationConfiguration>();

            config.FirstTimeSetUpCompleted  = setUpCompleted;
            config.EnableProductImprovement = true;
            _database.SaveChanges();
        }
        public void Execute(IDeregisterOdsInstanceModel userModel)
        {
            var odsInstance = _database.OdsInstanceRegistrations.Single(x => x.Id == userModel.OdsInstanceId);

            RemoveInstanceSetupConfigurations(odsInstance.Name);

            RemoveExistingSecretConfigurations(userModel.OdsInstanceId);

            RemoveExistingUserOdsInstanceRegistrations(userModel.OdsInstanceId);

            _database.OdsInstanceRegistrations.Remove(odsInstance);

            _database.SaveChanges();
        }
 public static void Save <TEntity>(List <TEntity> values) where TEntity : Entity
 {
     using (var database = new AdminAppDbContext())
     {
         database.Set <TEntity>().AddRange(values);
         database.SaveChanges();
     }
 }
Пример #4
0
 private static void AddSecretConfiguration(string jsonConfiguration, int odsInstanceRegistrationId)
 {
     using (var database = new AdminAppDbContext())
     {
         database.SecretConfigurations.Add(new SecretConfiguration {
             EncryptedData = jsonConfiguration, OdsInstanceRegistrationId = odsInstanceRegistrationId
         });
         database.SaveChanges();
     }
 }
Пример #5
0
 private static void EnsureZeroSqlConfigurations()
 {
     using (var database = new AdminAppDbContext())
     {
         foreach (var entity in database.AzureSqlConfigurations)
         {
             database.AzureSqlConfigurations.Remove(entity);
         }
         database.SaveChanges();
     }
 }
Пример #6
0
        private static void EnsureOneSqlConfiguration(string jsonConfiguration)
        {
            EnsureZeroSqlConfigurations();

            using (var database = new AdminAppDbContext())
            {
                database.AzureSqlConfigurations.Add(new AzureSqlConfiguration {
                    Configurations = jsonConfiguration
                });
                database.SaveChanges();
            }
        }
Пример #7
0
        private static OdsInstanceRegistration CreateOdsInstanceRegistration(string instanceName)
        {
            OdsInstanceRegistration createdOdsInstanceRegistration;

            using (var database = new AdminAppDbContext())
            {
                database.OdsInstanceRegistrations.Add(new OdsInstanceRegistration {
                    Name = instanceName
                });
                database.SaveChanges();
                createdOdsInstanceRegistration = database.OdsInstanceRegistrations.FirstOrDefault(x => x.Name == instanceName);
            }

            return(createdOdsInstanceRegistration);
        }