Creation of EF Core Migrations - these execute using EF Tools, but are not integrated to run programmatically
This commit is contained in:
33
Oqtane.Server/Migrations/Framework/ForeignKey.cs
Normal file
33
Oqtane.Server/Migrations/Framework/ForeignKey.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
|
||||
using Oqtane.Migrations.EntityBuilders;
|
||||
|
||||
namespace Oqtane.Migrations
|
||||
{
|
||||
public readonly struct ForeignKey<TEntityBuilder> where TEntityBuilder : BaseEntityBuilder<TEntityBuilder>
|
||||
{
|
||||
public ForeignKey(string name, Expression<Func<TEntityBuilder, object>> column, string principalTable, string principalColumn, ReferentialAction onDeleteAction)
|
||||
{
|
||||
Name = name;
|
||||
Column = column;
|
||||
PrincipalTable = principalTable;
|
||||
PrincipalColumn = principalColumn;
|
||||
OnDeleteAction = onDeleteAction;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public Expression<Func<TEntityBuilder, object>> Column { get;}
|
||||
|
||||
public ReferentialAction OnDeleteAction { get; }
|
||||
|
||||
public string PrincipalTable { get; }
|
||||
|
||||
public string PrincipalColumn { get; }
|
||||
|
||||
|
||||
}
|
||||
}
|
21
Oqtane.Server/Migrations/Framework/PrimaryKey.cs
Normal file
21
Oqtane.Server/Migrations/Framework/PrimaryKey.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Oqtane.Migrations.EntityBuilders;
|
||||
|
||||
namespace Oqtane.Migrations
|
||||
{
|
||||
public readonly struct PrimaryKey<TEntityBuilder> where TEntityBuilder : BaseEntityBuilder<TEntityBuilder>
|
||||
{
|
||||
public PrimaryKey(string name, Expression<Func<TEntityBuilder, object>> columns)
|
||||
{
|
||||
Name = name;
|
||||
Columns = columns;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public Expression<Func<TEntityBuilder, object>> Columns { get;}
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user