private void CreateTable()
        {
            var columnsToCreate = new List <string>();

            foreach (KeyValuePair <string, string> kvp in _databaseColumns)
            {
                columnsToCreate.Add($"{Environment.NewLine}    [{kvp.Key}]    {kvp.Value}");
            }

            string sql = $"CREATE TABLE {_settings.TableNameQualified} ({string.Join(",", columnsToCreate)})";

            _databaseCommander.ExecuteNonQuery(sql);

            if (_settings.IsAppendAuditFields)
            {
                _databaseCommander.ExecuteNonQuery($"ALTER TABLE {_settings.TableNameQualified} ALTER COLUMN CreatedBy    VARCHAR(100)  NOT NULL");
                _databaseCommander.ExecuteNonQuery($"ALTER TABLE {_settings.TableNameQualified} ALTER COLUMN CreatedDate  DATETIME      NOT NULL");
            }
        }
Ejemplo n.º 2
0
 public override SqlNonQueryResult Execute()
 {
     return(_databaseCommander.ExecuteNonQuery((SqlNonQueryRequest)CommandRequest));
 }