Skip to content
Jay Harris edited this page Apr 21, 2016 · 2 revisions

Cobweb.Data.FluentMigrator

FluentMigrator utilities and classes for Cobweb, a base-class utility library for .NET

Install

To install the package, run the following from the Package Manager Console:

Install-Package Cobweb.Data.FluentMigrator

Column syntax utilities

The library includes several extension methods to extend FluentMigrator. When creating or modifying a column, these extensions allow all schema, properties, and options for that column to be grouped and contained within the Column functions.

Create Table syntax

WithColumn(string columnName, Func columnOptions)

Example

Create.Table("TableName")
      .WithColumn("ColumnName", col => col.AsInt32().NotNullable())
      .WithColumn("AnotherName", col => col.AsBoolean());

Alter Table syntax

AddColumn(string columnName, Func columnOptions)

AlterColumn(string columnName, Func columnOptions)

Example

Alter.Table("TableName")
     .AddColumn("ColumnName", col => col.AsInt32().NotNullable())
     .AlterColumn("AnotherName", col => col.AsBoolean());