@@ -7,4 +7,8 @@ https://www.cnblogs.com/cqpanda/p/16815263.html
|
||||
|
||||
# 该目录下如果有多个上下文,需要手动指定
|
||||
|
||||
dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations
|
||||
# dotnet ef migrations add 签名名字 -p 项目名 -c 上下文名 -o 迁移文件生成目录
|
||||
|
||||
dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations
|
||||
|
||||
dotnet ef database update -p IRaCIS.Core.Test -c IRCContext
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||
{
|
||||
[DbContext(typeof(IRCContext))]
|
||||
[Migration("20240910055957_navigateTest")]
|
||||
partial class navigateTest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("CreateUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("TestName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<Guid>("TrialImageDownloadId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("UpdateUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TrialImageDownloadId");
|
||||
|
||||
b.ToTable("TestNew");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("CreateUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("DownloadEndTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DownloadStartTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ImageCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("ImageSize")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("ImageType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsSuccess")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<Guid>("SubjectVisitId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("UpdateUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TrialImageDownload");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b =>
|
||||
{
|
||||
b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", null)
|
||||
.WithMany("TestNewList")
|
||||
.HasForeignKey("TrialImageDownloadId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
|
||||
{
|
||||
b.Navigation("TestNewList");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class navigateTest : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "TrialImageDownloadId",
|
||||
table: "TestNew",
|
||||
type: "uniqueidentifier",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TestNew_TrialImageDownloadId",
|
||||
table: "TestNew",
|
||||
column: "TrialImageDownloadId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TestNew_TrialImageDownload_TrialImageDownloadId",
|
||||
table: "TestNew",
|
||||
column: "TrialImageDownloadId",
|
||||
principalTable: "TrialImageDownload",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TestNew_TrialImageDownload_TrialImageDownloadId",
|
||||
table: "TestNew");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_TestNew_TrialImageDownloadId",
|
||||
table: "TestNew");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TrialImageDownloadId",
|
||||
table: "TestNew");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,9 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<Guid>("TrialImageDownloadId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@@ -46,6 +49,8 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TrialImageDownloadId");
|
||||
|
||||
b.ToTable("TestNew");
|
||||
});
|
||||
|
||||
@@ -91,6 +96,20 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||
|
||||
b.ToTable("TrialImageDownload");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b =>
|
||||
{
|
||||
b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", null)
|
||||
.WithMany("TestNewList")
|
||||
.HasForeignKey("TrialImageDownloadId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
|
||||
{
|
||||
b.Navigation("TestNewList");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
|
||||
public int ImageCount { get; set; }
|
||||
|
||||
public long ImageSize { get; set; }
|
||||
|
||||
#region 测试导航属性
|
||||
|
||||
public List<TestNew> TestNewList { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum ImageType
|
||||
@@ -33,8 +39,10 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
|
||||
NoneDIcom = 2
|
||||
};
|
||||
|
||||
public class TestNew: BaseFullAuditEntity
|
||||
public class TestNew : BaseFullAuditEntity
|
||||
{
|
||||
public Guid TrialImageDownloadId { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string TestName { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user