Aranasoft.Cobweb.FluentMigrator.Extensions
3.1.0
dotnet add package Aranasoft.Cobweb.FluentMigrator.Extensions --version 3.1.0
NuGet\Install-Package Aranasoft.Cobweb.FluentMigrator.Extensions -Version 3.1.0
<PackageReference Include="Aranasoft.Cobweb.FluentMigrator.Extensions" Version="3.1.0" />
paket add Aranasoft.Cobweb.FluentMigrator.Extensions --version 3.1.0
#r "nuget: Aranasoft.Cobweb.FluentMigrator.Extensions, 3.1.0"
// Install Aranasoft.Cobweb.FluentMigrator.Extensions as a Cake Addin
#addin nuget:?package=Aranasoft.Cobweb.FluentMigrator.Extensions&version=3.1.0
// Install Aranasoft.Cobweb.FluentMigrator.Extensions as a Cake Tool
#tool nuget:?package=Aranasoft.Cobweb.FluentMigrator.Extensions&version=3.1.0
An alternative fluent interface for FluentMigrator.
Cobweb was created by Arana Software, a software agency in Las Vegas, Nevada.
Alternate Syntax for FluentMigrator
Aranasoft.Cobweb.FluentMigrator.Extensions
provides an alternate syntax style for FluentMigrator, a database migration framework for .NET, using lambda expression syntax instead of method chains.
FluentMigrator's Method Chain Syntax
FluentMigrator employes a series of chained expression to build database schema.
Create.Table("TestTable")
.WithColumn("FirstColumn").AsString().Nullable().WithDefaultValue("test")
.WithColumn("SecondColumn").AsString().NotNullable().WithDefaultValue("sample");
Though this style is effective, some may find the syntax confusing, as there is no clear delineation between setting column properties and transitioning additional columns. Because this grouping can only be resolved through the context of method names, it is also impossible for code-formatting tools to organize and group applicable code.
Cobweb's Lambda Expression Syntax
Cobweb uses lambda expressions to define column properties.
Create.Table("TestTable")
.WithColumn("FirstColumn", col => col.AsString().Nullable().WithDefaultValue("test"))
.WithColumn("SecondColumn, col => col.AsString().NotNullable().WithDefaultValue("sample"));
Under the covers, Cobweb passes these lambda expressions to FluentMigrator's method chains. The lambda syntax will naturally group column properties and delineate from other columns. This grouping also enables code formating support from editor tooling.
Usage
Create Table: WithColumn
Syntax: WithColumn(string columnName, Func columnOptions)
Create.Table("TestTable")
.WithColumn("FirstColumn", col => col.AsString().Nullable())
.WithColumn("SecondColumn, col => col.AsString().NotNullable().WithDefaultValue("sample"));
Alter Table: AddColumn
Syntax: AddColumn(string columnName, Func columnOptions)
Alter.Table("TestTable")
.AddColumn("FirstColumn", col => col.AsInt32().Nullable())
.AddColumn("SecondColumn", col => col.AsInt32().NotNullable().WithDefaultValue(5)));
Alter Table: AlterColumn
Syntax: AlterColumn(string columnName, Func columnOptions)
Alter.Table("TestTable")
.AlterColumn("FirstExistingColumn", col => col.AsInt32())
.AlterColumn("SecondExistingColumn", col => col.AsInt32().NotNullable().WithDefaultValue(5)));
Create Index: OnColumn
Syntax: OnColumn(string columnName, Func columnOptions)
Create.Index("TestIndex")
.OnColumn("FirstColumn", col => col.Ascending())
.OnColumn("SecondColumn", col => col.Descending());
Release Notes: 3.1.0 (2019-12-10)
Code Refactoring
- namespaces: revise namespaces to Aranasoft.Cobweb (56aa10b)
BREAKING CHANGES
- namespaces: the root namespace has been changed from
Cobweb
toAranasoft.Cobweb
. For example, theMigrationExtensions
class is now located withinAranasoft.Cobweb.FluentMigrator.Extensions
. (56aa10b)
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETFramework 4.6.1
- FluentMigrator (>= 3.0.0 && < 4.0.0)
-
.NETStandard 2.0
- FluentMigrator (>= 3.0.0 && < 4.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.