Integration between SQL View definitions and the Migration framework.
- ViewSqlGenerator generates static DDL (CREATE VIEW / DROP VIEW) from view attributes for use in migrations
- ViewMigrationExtensions provides extension methods on
SqlMigrationfor creating and dropping views within migration steps
- Birko.Data.SQL.View
- Birko.Data.Migrations.SQL
using Birko.Data.SQL.View.Migrations;
public class AddCustomerOrdersView : SqlMigration
{
public override void Up()
{
// Create view from attributed class
this.CreateView<CustomerOrderView>();
}
public override void Down()
{
// Drop the view
this.DropView("customer_orders_view");
}
}The ViewSqlGenerator accepts a quoteChar parameter for provider-specific identifier quoting:
// SQL Server: [column_name]
var sql = ViewSqlGenerator.GenerateCreateViewSql<CustomerOrderView>(quoteChar: ("\"", "\""));
// MySQL: `column_name`
var sql = ViewSqlGenerator.GenerateCreateViewSql<CustomerOrderView>(quoteChar: ("`", "`"));- ViewSqlGenerator - Static methods for generating CREATE/DROP VIEW DDL from view attributes
GenerateCreateViewSql<T>(quoteChar)— generates CREATE VIEW statementGenerateDropViewSql<T>()— generates DROP VIEW IF EXISTS statement
- ViewMigrationExtensions - Extension methods on
SqlMigrationCreateView<T>()— adds CREATE VIEW step to the migrationDropView(viewName)— adds DROP VIEW step to the migration
- Birko.Data.SQL.View - Base view framework
- Birko.Data.Migrations.SQL - SQL migration framework
Part of the Birko Framework.