Inheritance: IColumnBuilder
        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);
        }
Esempio n. 2
0
        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));
        }