Beispiel #1
0
 public void CreateTableIfNotExists()
 {
     if (TableExist() == false)
     {
         DbWriteCommands.CreateTable(_connectionString);
     }
 }
        private bool GetToggleValue(string toggle)
        {
            using (var connection = new SqlConnection(_connectionString))
                using (var command = new SqlCommand())
                {
                    connection.Open();

                    command.Connection = connection;

                    var reader = DbReadCommands.SelectToggleValueCommand(toggle, command);

                    if (reader.HasRows == false)
                    {
                        DbWriteCommands.CreateToggleRow(toggle, _connectionString);
                    }

                    return(ReadToggleValue(reader));
                }
        }
Beispiel #3
0
        public void SetToggle(bool toggle, string toggleName)
        {
            using (var connection = new SqlConnection(_connectionString))
                using (var command = new SqlCommand())
                {
                    connection.Open();

                    command.Connection = connection;

                    var reader = DbReadCommands.SelectToggleValueCommand(toggleName, command);

                    if (reader.HasRows == false)
                    {
                        DbWriteCommands.CreateToggleRow(toggleName, toggle, _connectionString);
                    }
                    else
                    {
                        DbWriteCommands.UpdateToggleRow(toggleName, toggle, _connectionString);
                    }
                }
        }