private ColumnBuilder PrepareColumn(string columnName, SQLiteDbType type)
        {
            if (columnName == null)
            {
                throw new ArgumentNullException(nameof(columnName));
            }
            if (string.IsNullOrEmpty(columnName))
            {
                throw new InvalidOperationException($"{nameof(columnName)} cannot be empty.");
            }

            if (_table.Columns.Any(c => c.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase)))
            {
                throw new InvalidOperationException($"A column with name \"{columnName}\" has already been added.");
            }

            var column = new ColumnEntity();

            column.Name = columnName;
            column.Type = type;

            _table.Columns.Add(column);

            return(new ColumnBuilder(this, column));
        }
Exemple #2
0
        public ColumnBuilder(TableBuilder tableBuilder, ColumnEntity column)
        {
            if (tableBuilder == null)
            {
                throw new ArgumentNullException(nameof(tableBuilder));
            }
            if (column == null)
            {
                throw new ArgumentNullException(nameof(column));
            }

            _tableBuilder = tableBuilder;
            _column       = column;
        }