public static ICreateTableStatementBuilder WithColumn(this ICreateTableStatementBuilder builder, Action<IColumnBuilder> column) { var columnBuilder = new ColumnBuilder(); column(columnBuilder); ColumnConstraintInfo constraint; var columnResult = columnBuilder.Build(out constraint); if (constraint != null) builder.WithConstraint(new SqlTableConstraint(constraint.ConstraintType, new []{columnResult.ColumnName}) { ReferenceTable = constraint.ReferencedTable == null ? null : constraint.ReferencedTable.ToString(), ReferenceColumns = new []{constraint.ReferencedColumnName}, OnUpdate = constraint.ActionOnUpdate, OnDelete = constraint.ActionOnDelete }); return builder.WithColumn(columnResult); }
public static ICreateTableStatementBuilder WithColumn(this ICreateTableStatementBuilder builder, Action <IColumnBuilder> column) { var columnBuilder = new ColumnBuilder(); column(columnBuilder); ColumnConstraintInfo constraint; var columnResult = columnBuilder.Build(out constraint); if (constraint != null) { builder.WithConstraint(new SqlTableConstraint(constraint.ConstraintType, new [] { columnResult.ColumnName }) { ReferenceTable = constraint.ReferencedTable == null ? null : constraint.ReferencedTable.ToString(), ReferenceColumns = new [] { constraint.ReferencedColumnName }, OnUpdate = constraint.ActionOnUpdate, OnDelete = constraint.ActionOnDelete }); } return(builder.WithColumn(columnResult)); }