From df1665307a2e4c5a0e320009c8c1db126478f27f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 12 Sep 2024 16:09:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImageAndDoc/DTO/UnionStudyViewDodel.cs | 5 - .../ImageAndDoc/DownloadAndUploadService.cs | 43 +- .../Service/ImageAndDoc/StudyService.cs | 13 +- .../EntityConfigration/SubjectConfigration.cs | 1 + .../Convention/MaxStringLengthConvention .cs | 6 +- .../Convention/NoForeignKeyConvention.cs | 26 - .../NoForeignKeyMigrationsSqlGenerator.cs | 20 +- .../DictionaryConfigration.cs | 24 +- .../EntityConfigration/SubjectConfigration.cs | 22 +- .../CodeFirstTest/MSSQL/IRCContext.cs | 35 +- .../Migrations/20240910053652_testAdd.cs | 38 -- .../Migrations/20240910055957_navigateTest.cs | 51 -- ...910073024_oneToManyAndOneToOne.Designer.cs | 213 -------- .../20240910073024_oneToManyAndOneToOne.cs | 96 ---- ...75136_seftOneToManyAndOneToOne.Designer.cs | 269 ----------- ...20240910075136_seftOneToManyAndOneToOne.cs | 60 --- .../20240911143331_testMaxLength.Designer.cs | 356 -------------- .../20240911143331_testMaxLength.cs | 111 ----- .../20240911144206_teststr.Designer.cs | 394 --------------- ...0240912054434_RemoveForeignKey.Designer.cs | 456 ------------------ ...240912064923_RemoveForeignKey.Designer.cs} | 52 +- ....cs => 20240912064923_RemoveForeignKey.cs} | 0 ... => 20240912065315_ForeignKey.Designer.cs} | 94 ++-- ...eststr.cs => 20240912065315_ForeignKey.cs} | 28 +- .../20240912072724_addField.Designer.cs | 141 ++++++ .../Migrations/20240912072724_addField.cs | 42 ++ .../Migrations/IRCContextModelSnapshot.cs | 403 ++-------------- .../CodeFirstTest/MSSQL/TrialImageDownload.cs | 107 ++-- 28 files changed, 444 insertions(+), 2662 deletions(-) delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/NoForeignKeyConvention.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.Designer.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.Designer.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.Designer.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911144206_teststr.Designer.cs delete mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912054434_RemoveForeignKey.Designer.cs rename IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/{20240910053652_testAdd.Designer.cs => 20240912064923_RemoveForeignKey.Designer.cs} (68%) rename IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/{20240912054434_RemoveForeignKey.cs => 20240912064923_RemoveForeignKey.cs} (100%) rename IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/{20240910055957_navigateTest.Designer.cs => 20240912065315_ForeignKey.Designer.cs} (62%) rename IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/{20240911144206_teststr.cs => 20240912065315_ForeignKey.cs} (54%) create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912072724_addField.Designer.cs create mode 100644 IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912072724_addField.cs diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index ef8f3fdf4..071affd3e 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -186,11 +186,6 @@ namespace IRaCIS.Core.Application.Contracts [NotDefault] public Guid SubjectVisitId { get; set; } - public long FileSize { get; set; } - - public bool IsDicomReUpload { get; set; } - - public int FileCount { get; set; } } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 890a2c9bc..16ec18d5e 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -232,16 +232,11 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc TrialId = preArchiveStudyCommand.TrialId, SubjectId = preArchiveStudyCommand.SubjectId, SubjectVisitId = preArchiveStudyCommand.SubjectVisitId, - IsSuccess = false, UploadStartTime = DateTime.Now, IsDicom = true, IP = _userInfo.IP, - - IsDicomReUpload = preArchiveStudyCommand.IsDicomReUpload, - FileSize = preArchiveStudyCommand.FileSize, FileCount = preArchiveStudyCommand.FileCount, - }; @@ -372,17 +367,20 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc studyMonitor.FailedFileCount = incommand.FailedFileCount; studyMonitor.IsSuccess = incommand.FailedFileCount == 0; studyMonitor.RecordPath = incommand.RecordPath; + studyMonitor.FileSize = incommand.Study.SeriesList.SelectMany(t => t.InstanceList).Sum(t => t.FileSize); + + var studyId = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString()); + var findStudy = await _taskStudyRepository.FirstOrDefaultAsync(t => t.Id == studyId); + + + studyMonitor.StudyId = studyId; + studyMonitor.StudyCode = findStudy?.StudyCode ?? ""; + + studyMonitor.IsDicomReUpload = findStudy != null; //上传 if (studyMonitor.IsDicomReUpload == false) { - //目前不考虑重传的问题,后面的直接覆盖前面的,全部删除 - if (_taskStudyRepository.Any(t => t.VisitTaskId == visiTaskId && t.StudyInstanceUid == incommand.Study.StudyInstanceUid)) - { - await _taskStudyRepository.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visiTaskId); - await _taskSeriesRepository.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visiTaskId); - await _taskInstanceRepository.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visiTaskId); - } var study = _mapper.Map(incommand.Study); @@ -422,7 +420,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc await _taskStudyRepository.AddAsync(study); - studyMonitor.StudyId = study.Id; studyMonitor.StudyCode = study.StudyCode; @@ -465,18 +462,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc else { - var studyId = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString(), visiTaskId.ToString()); - var study = await _taskStudyRepository.FirstOrDefaultAsync(t => t.Id == studyId); //重传的时候也要赋值检查Id - studyMonitor.StudyId = study.Id; - studyMonitor.StudyCode = study.StudyCode; + studyMonitor.StudyId = findStudy.Id; + studyMonitor.StudyCode = findStudy.StudyCode; //特殊处理逻辑 - study.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Union(study.Modalities.Split("、", StringSplitOptions.RemoveEmptyEntries)).Distinct()); - SpecialArchiveStudyDeal(study); - modalitys = study.Modalities; + findStudy.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Union(findStudy.Modalities.Split("、", StringSplitOptions.RemoveEmptyEntries)).Distinct()); + SpecialArchiveStudyDeal(findStudy); + modalitys = findStudy.Modalities; // 少了整个序列 @@ -494,7 +489,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var series = _mapper.Map(seriesItem); series.Id = seriesId; - series.StudyId = study.Id; + series.StudyId = findStudy.Id; series.TrialId = incommand.TrialId; series.SubjectId = incommand.SubjectId; @@ -505,7 +500,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc dicomSeries = await _taskSeriesRepository.AddAsync(series); //新的序列 那么 检查的序列数量+1 - study.SeriesCount += 1; + findStudy.SeriesCount += 1; } else { @@ -517,7 +512,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { var insntance = _mapper.Map(instanceItem); insntance.Id = IdentifierHelper.CreateGuid(insntance.StudyInstanceUid, insntance.SeriesInstanceUid, insntance.SopInstanceUid, trialId.ToString(), visiTaskId.ToString()); - insntance.StudyId = study.Id; + insntance.StudyId = findStudy.Id; insntance.SeriesId = dicomSeries.Id; insntance.TrialId = incommand.TrialId; @@ -529,7 +524,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc // 不管是新的序列 还是 该序列 掉了Instance 重传的时候 检查的instance 数量都会增加 - study.InstanceCount += seriesItem.InstanceList.Count; + findStudy.InstanceCount += seriesItem.InstanceList.Count; } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index ea22cafaf..85bab0591 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -171,6 +171,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc studyMonitor.StudyId = studyId; studyMonitor.StudyCode = findStudy?.StudyCode??""; + studyMonitor.IsDicomReUpload = findStudy != null; if (incommand.Study.SeriesList.SelectMany(t => t.InstanceList).Count() == 0) @@ -183,18 +184,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc //上传 if (studyMonitor.IsDicomReUpload == false) { - - //如果因为意外情况,连续点击两次,导致第一次插入了,第二次进来也会插入,在此判断一下 - if (findStudy != null) - { - - await _studyMonitorRepository.SaveChangesAsync(); - - //直接返回 - return ResponseOutput.Ok(); - } - - var addStudy = _mapper.Map(incommand.Study); var @lock = _distributedLockProvider.CreateLock($"StudyCode"); diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs index a71465dd8..fef08e64e 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs @@ -20,6 +20,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration { public void Configure(EntityTypeBuilder builder) { + builder.HasOne(t => t.ConfigDictionary).WithMany().HasForeignKey(d => d.ConfigTypeId); //自身同时存在一对多 和一对一的关系,配置一对多的就可以,一对一 不用配置,有点奇怪 builder.HasMany(t => t.ChildList).WithOne(t => t.Parent).HasForeignKey(d => d.ParentId); } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/MaxStringLengthConvention .cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/MaxStringLengthConvention .cs index e15a8e573..a7ab7624a 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/MaxStringLengthConvention .cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/MaxStringLengthConvention .cs @@ -1,10 +1,6 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions; -using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace IRaCIS.Core.Test { @@ -21,7 +17,7 @@ namespace IRaCIS.Core.Test .Where( property => property.ClrType == typeof(string)))) { - property.Builder.HasMaxLength(200); + property.Builder.HasMaxLength(200); } } } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/NoForeignKeyConvention.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/NoForeignKeyConvention.cs deleted file mode 100644 index 6fc9727d6..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/NoForeignKeyConvention.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.EntityFrameworkCore.Metadata.Conventions; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore; -namespace IRaCIS.Core.Test -{ - /// - /// 这种方式不行 - /// - public class NoForeignKeyConvention : IModelFinalizingConvention - { - public void ProcessModelFinalizing(IConventionModelBuilder modelBuilder, IConventionContext context) - { - foreach (var entityType in modelBuilder.Metadata.GetEntityTypes()) - { - foreach (var foreignKey in entityType.GetForeignKeys()) - { - // 设置删除行为为 NoAction,避免生成外键约束 - foreignKey.Builder.OnDelete(DeleteBehavior.NoAction); - } - } - } - } -} - - diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/NoForeignKeyMigrationsSqlGenerator.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/NoForeignKeyMigrationsSqlGenerator.cs index 0b42a15d9..934413c0a 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/NoForeignKeyMigrationsSqlGenerator.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Convention/NoForeignKeyMigrationsSqlGenerator.cs @@ -1,10 +1,6 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations.Operations; -using Microsoft.EntityFrameworkCore.Metadata; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations.Internal; -using Microsoft.EntityFrameworkCore.Storage; namespace IRaCIS.Core.Test { @@ -15,16 +11,10 @@ namespace IRaCIS.Core.Test { } - protected override void Generate(MigrationOperation operation, IModel model, MigrationCommandListBuilder builder) + protected override void Generate(Microsoft.EntityFrameworkCore.Migrations.Operations.CreateTableOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true) { - if (operation is AddForeignKeyOperation || operation is DropForeignKeyOperation) - { - // 跳过外键的生成 - return; - } - - base.Generate(operation, model, builder); + operation.ForeignKeys.Clear(); + base.Generate(operation, model, builder, terminate); } } - } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/DictionaryConfigration.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/DictionaryConfigration.cs index 07ea337df..04f26821c 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/DictionaryConfigration.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/DictionaryConfigration.cs @@ -1,24 +1,18 @@ -using IRaCIS.Core.Domain.Models; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL { - public class DictionaryConfigration : IEntityTypeConfiguration - { + //public class DictionaryConfigration : IEntityTypeConfiguration + //{ - public void Configure(EntityTypeBuilder builder) - { + // public void Configure(EntityTypeBuilder builder) + // { + // //builder.HasOne(t => t.ConfigType).WithMany().HasForeignKey(d => d.ConfigTypeId); + // //builder.HasMany(t => t.ChildList).WithOne(t => t.Parent).HasForeignKey(d => d.ParentId); - builder.HasMany(t => t.ChildList).WithOne(t => t.Parent).HasForeignKey(d => d.ParentId); - - } - } + // } + //} } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/SubjectConfigration.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/SubjectConfigration.cs index ff0800238..9cd9007ee 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/SubjectConfigration.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/EntityConfigration/SubjectConfigration.cs @@ -4,19 +4,19 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL { - public class SubjectConfigration : IEntityTypeConfiguration - { - + //public class SubjectConfigration : IEntityTypeConfiguration + //{ - public void Configure(EntityTypeBuilder builder) - { - //不能同时配置一对多 和一对一 但是有时表要存储多的最新的 比如受试者 最新的访视 在这里要显示配置 - builder.HasOne(s => s.LatestSubjectVisit); - builder.HasOne(s => s.FinalSubjectVisit); - builder.HasMany(s => s.SubejectVisitList).WithOne(sv => sv.Subject); - } - } + // public void Configure(EntityTypeBuilder builder) + // { + + // //不能同时配置一对多 和一对一 但是有时表要存储多的最新的 比如受试者 最新的访视 在这里要显示配置 + // builder.HasOne(s => s.LatestSubjectVisit); + // builder.HasOne(s => s.FinalSubjectVisit); + // builder.HasMany(s => s.SubejectVisitList).WithOne(sv => sv.Subject); + // } + //} } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs index 6f7889277..2792bb81c 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/IRCContext.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Migrations; +using System; using System.Linq; using System.Reflection; -using IRaCIS.Core.Test.CodeFirstTest.MSSQL; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.Extensions.Options; namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL; @@ -20,28 +17,24 @@ public partial class IRCContext : DbContext { } - public virtual DbSet TrialImageDownload { get; set; } - - public virtual DbSet TestNew { get; set; } - - public virtual DbSet Subject { get; set; } - - public virtual DbSet SubejectVisit { get; set; } - - public virtual DbSet Dictionary { get; set; } - public virtual DbSet ReadingClinicalData { get; set; } - public virtual DbSet ReadModule { get; set; } - - public virtual DbSet TestStringLength { get; set; } + //public virtual DbSet TrialImageDownload { get; set; } + //public virtual DbSet TestNew { get; set; } + //public virtual DbSet Subject { get; set; } + //public virtual DbSet SubejectVisit { get; set; } + //public virtual DbSet Dictionary { get; set; } + //public virtual DbSet ReadingClinicalData { get; set; } + //public virtual DbSet ReadModule { get; set; } + //public virtual DbSet TestStringLength { get; set; } public virtual DbSet Project { get; set; } public virtual DbSet ProjectUser { get; set; } + public virtual DbSet ProjectUser2 { get; set; } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - // 替换默认的 MigrationsSqlGenerator optionsBuilder.ReplaceService(); optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=IRC_Code;User ID=sa;Password=mssql_KnTs2a;TrustServerCertificate=true"); @@ -66,7 +59,7 @@ public partial class IRCContext : DbContext protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) { - + //configurationBuilder.Conventions.Add(_ => new NoForeignKeyConvention()); //针对字符串使用默认的长度配置 configurationBuilder.Conventions.Add(_ => new MaxStringLengthConvention()); } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.cs deleted file mode 100644 index e42fa119c..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations -{ - /// - public partial class testAdd : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "TestNew", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - TestName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), - CreateTime = table.Column(type: "datetime2", nullable: false), - UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false), - UpdateTime = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TestNew", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "TestNew"); - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs deleted file mode 100644 index 0f56141b3..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations -{ - /// - public partial class navigateTest : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - 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); - } - - /// - 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"); - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.Designer.cs deleted file mode 100644 index 20cdc133f..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.Designer.cs +++ /dev/null @@ -1,213 +0,0 @@ -// -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("20240910073024_oneToManyAndOneToOne")] - partial class oneToManyAndOneToOne - { - /// - 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.SubejectVisit", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("SubjectId"); - - b.ToTable("SubejectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("FinalSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("LatestSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("FinalSubjectVisitId"); - - b.HasIndex("LatestSubjectVisitId"); - - b.ToTable("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TrialImageDownloadId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TrialImageDownloadId"); - - b.ToTable("TestNew"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DownloadEndTime") - .HasColumnType("datetime2"); - - b.Property("DownloadStartTime") - .HasColumnType("datetime2"); - - b.Property("ImageCount") - .HasColumnType("int"); - - b.Property("ImageSize") - .HasColumnType("bigint"); - - b.Property("ImageType") - .HasColumnType("int"); - - b.Property("IsSuccess") - .HasColumnType("bit"); - - b.Property("SubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("TrialImageDownload"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject") - .WithMany("SubejectVisitList") - .HasForeignKey("SubjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "FinalSubjectVisit") - .WithMany() - .HasForeignKey("FinalSubjectVisitId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "LatestSubjectVisit") - .WithMany() - .HasForeignKey("LatestSubjectVisitId"); - - b.Navigation("FinalSubjectVisit"); - - b.Navigation("LatestSubjectVisit"); - }); - - 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.Subject", b => - { - b.Navigation("SubejectVisitList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Navigation("TestNewList"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.cs deleted file mode 100644 index 3627f081b..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910073024_oneToManyAndOneToOne.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations -{ - /// - public partial class oneToManyAndOneToOne : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "SubejectVisit", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - SubjectId = table.Column(type: "uniqueidentifier", nullable: false), - CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), - CreateTime = table.Column(type: "datetime2", nullable: false), - UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false), - UpdateTime = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_SubejectVisit", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Subject", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: false), - LatestSubjectVisitId = table.Column(type: "uniqueidentifier", nullable: true), - FinalSubjectVisitId = table.Column(type: "uniqueidentifier", nullable: true), - CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), - CreateTime = table.Column(type: "datetime2", nullable: false), - UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false), - UpdateTime = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Subject", x => x.Id); - table.ForeignKey( - name: "FK_Subject_SubejectVisit_FinalSubjectVisitId", - column: x => x.FinalSubjectVisitId, - principalTable: "SubejectVisit", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_Subject_SubejectVisit_LatestSubjectVisitId", - column: x => x.LatestSubjectVisitId, - principalTable: "SubejectVisit", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_SubejectVisit_SubjectId", - table: "SubejectVisit", - column: "SubjectId"); - - migrationBuilder.CreateIndex( - name: "IX_Subject_FinalSubjectVisitId", - table: "Subject", - column: "FinalSubjectVisitId"); - - migrationBuilder.CreateIndex( - name: "IX_Subject_LatestSubjectVisitId", - table: "Subject", - column: "LatestSubjectVisitId"); - - migrationBuilder.AddForeignKey( - name: "FK_SubejectVisit_Subject_SubjectId", - table: "SubejectVisit", - column: "SubjectId", - principalTable: "Subject", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_SubejectVisit_Subject_SubjectId", - table: "SubejectVisit"); - - migrationBuilder.DropTable( - name: "Subject"); - - migrationBuilder.DropTable( - name: "SubejectVisit"); - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.Designer.cs deleted file mode 100644 index 69d7b8786..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.Designer.cs +++ /dev/null @@ -1,269 +0,0 @@ -// -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("20240910075136_seftOneToManyAndOneToOne")] - partial class seftOneToManyAndOneToOne - { - /// - 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.Dictionary", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ConfigTypeId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ConfigTypeId"); - - b.HasIndex("ParentId"); - - b.ToTable("Dictionary"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("SubjectId"); - - b.ToTable("SubejectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("FinalSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("LatestSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("FinalSubjectVisitId"); - - b.HasIndex("LatestSubjectVisitId"); - - b.ToTable("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TrialImageDownloadId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TrialImageDownloadId"); - - b.ToTable("TestNew"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DownloadEndTime") - .HasColumnType("datetime2"); - - b.Property("DownloadStartTime") - .HasColumnType("datetime2"); - - b.Property("ImageCount") - .HasColumnType("int"); - - b.Property("ImageSize") - .HasColumnType("bigint"); - - b.Property("ImageType") - .HasColumnType("int"); - - b.Property("IsSuccess") - .HasColumnType("bit"); - - b.Property("SubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("TrialImageDownload"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "ConfigType") - .WithMany() - .HasForeignKey("ConfigTypeId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "Parent") - .WithMany("ChildList") - .HasForeignKey("ParentId"); - - b.Navigation("ConfigType"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject") - .WithMany("SubejectVisitList") - .HasForeignKey("SubjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "FinalSubjectVisit") - .WithMany() - .HasForeignKey("FinalSubjectVisitId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "LatestSubjectVisit") - .WithMany() - .HasForeignKey("LatestSubjectVisitId"); - - b.Navigation("FinalSubjectVisit"); - - b.Navigation("LatestSubjectVisit"); - }); - - 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.Dictionary", b => - { - b.Navigation("ChildList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Navigation("SubejectVisitList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Navigation("TestNewList"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.cs deleted file mode 100644 index 32920762b..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910075136_seftOneToManyAndOneToOne.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations -{ - /// - public partial class seftOneToManyAndOneToOne : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Dictionary", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - ParentId = table.Column(type: "uniqueidentifier", nullable: true), - ConfigTypeId = table.Column(type: "uniqueidentifier", nullable: true), - Code = table.Column(type: "nvarchar(max)", nullable: false), - CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), - CreateTime = table.Column(type: "datetime2", nullable: false), - UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false), - UpdateTime = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Dictionary", x => x.Id); - table.ForeignKey( - name: "FK_Dictionary_Dictionary_ConfigTypeId", - column: x => x.ConfigTypeId, - principalTable: "Dictionary", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_Dictionary_Dictionary_ParentId", - column: x => x.ParentId, - principalTable: "Dictionary", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_Dictionary_ConfigTypeId", - table: "Dictionary", - column: "ConfigTypeId"); - - migrationBuilder.CreateIndex( - name: "IX_Dictionary_ParentId", - table: "Dictionary", - column: "ParentId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Dictionary"); - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.Designer.cs deleted file mode 100644 index 6afdc346a..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.Designer.cs +++ /dev/null @@ -1,356 +0,0 @@ -// -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("20240911143331_testMaxLength")] - partial class testMaxLength - { - /// - 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.Dictionary", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("ConfigTypeId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ConfigTypeId"); - - b.HasIndex("ParentId"); - - b.ToTable("Dictionary"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("ReadModule"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReadingId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ReadingId"); - - b.ToTable("ReadingClinicalData"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("SubjectId"); - - b.ToTable("SubejectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("FinalSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("LatestSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("FinalSubjectVisitId"); - - b.HasIndex("LatestSubjectVisitId"); - - b.ToTable("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TrialImageDownloadId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TrialImageDownloadId"); - - b.ToTable("TestNew"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DownloadEndTime") - .HasColumnType("datetime2"); - - b.Property("DownloadStartTime") - .HasColumnType("datetime2"); - - b.Property("ImageCount") - .HasColumnType("int"); - - b.Property("ImageSize") - .HasColumnType("bigint"); - - b.Property("ImageType") - .HasColumnType("int"); - - b.Property("IsSuccess") - .HasColumnType("bit"); - - b.Property("SubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("TrialImageDownload"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "ConfigType") - .WithMany() - .HasForeignKey("ConfigTypeId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "Parent") - .WithMany("ChildList") - .HasForeignKey("ParentId"); - - b.Navigation("ConfigType"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", "ReadModule") - .WithMany() - .HasForeignKey("ReadingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "SubjectVisit") - .WithMany() - .HasForeignKey("ReadingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ReadModule"); - - b.Navigation("SubjectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject") - .WithMany("SubejectVisitList") - .HasForeignKey("SubjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "FinalSubjectVisit") - .WithMany() - .HasForeignKey("FinalSubjectVisitId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "LatestSubjectVisit") - .WithMany() - .HasForeignKey("LatestSubjectVisitId"); - - b.Navigation("FinalSubjectVisit"); - - b.Navigation("LatestSubjectVisit"); - }); - - 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.Dictionary", b => - { - b.Navigation("ChildList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Navigation("SubejectVisitList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Navigation("TestNewList"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.cs deleted file mode 100644 index 420938bec..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations -{ - /// - public partial class testMaxLength : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Name", - table: "Subject", - type: "nvarchar(200)", - maxLength: 200, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AlterColumn( - name: "Code", - table: "Dictionary", - type: "nvarchar(200)", - maxLength: 200, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.CreateTable( - name: "ReadModule", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), - CreateTime = table.Column(type: "datetime2", nullable: false), - UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false), - UpdateTime = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ReadModule", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ReadingClinicalData", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Code = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - ReadingId = table.Column(type: "uniqueidentifier", nullable: false), - CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), - CreateTime = table.Column(type: "datetime2", nullable: false), - UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false), - UpdateTime = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ReadingClinicalData", x => x.Id); - table.ForeignKey( - name: "FK_ReadingClinicalData_ReadModule_ReadingId", - column: x => x.ReadingId, - principalTable: "ReadModule", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ReadingClinicalData_SubejectVisit_ReadingId", - column: x => x.ReadingId, - principalTable: "SubejectVisit", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ReadingClinicalData_ReadingId", - table: "ReadingClinicalData", - column: "ReadingId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ReadingClinicalData"); - - migrationBuilder.DropTable( - name: "ReadModule"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "Subject", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(200)", - oldMaxLength: 200); - - migrationBuilder.AlterColumn( - name: "Code", - table: "Dictionary", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(200)", - oldMaxLength: 200); - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911144206_teststr.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911144206_teststr.Designer.cs deleted file mode 100644 index 55e35c9f0..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911144206_teststr.Designer.cs +++ /dev/null @@ -1,394 +0,0 @@ -// -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("20240911144206_teststr")] - partial class teststr - { - /// - 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.Dictionary", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("ConfigTypeId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ConfigTypeId"); - - b.HasIndex("ParentId"); - - b.ToTable("Dictionary"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("ReadModule"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReadingId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ReadingId"); - - b.ToTable("ReadingClinicalData"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("SubjectId"); - - b.ToTable("SubejectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("FinalSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("LatestSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("FinalSubjectVisitId"); - - b.HasIndex("LatestSubjectVisitId"); - - b.ToTable("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TrialImageDownloadId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TrialImageDownloadId"); - - b.ToTable("TestNew"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestStringLength", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DefaultLength") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserDefineLength") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("UserDefineText") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("TestStringLength"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DownloadEndTime") - .HasColumnType("datetime2"); - - b.Property("DownloadStartTime") - .HasColumnType("datetime2"); - - b.Property("ImageCount") - .HasColumnType("int"); - - b.Property("ImageSize") - .HasColumnType("bigint"); - - b.Property("ImageType") - .HasColumnType("int"); - - b.Property("IsSuccess") - .HasColumnType("bit"); - - b.Property("SubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("TrialImageDownload"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "ConfigType") - .WithMany() - .HasForeignKey("ConfigTypeId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "Parent") - .WithMany("ChildList") - .HasForeignKey("ParentId"); - - b.Navigation("ConfigType"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", "ReadModule") - .WithMany() - .HasForeignKey("ReadingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "SubjectVisit") - .WithMany() - .HasForeignKey("ReadingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ReadModule"); - - b.Navigation("SubjectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject") - .WithMany("SubejectVisitList") - .HasForeignKey("SubjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "FinalSubjectVisit") - .WithMany() - .HasForeignKey("FinalSubjectVisitId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "LatestSubjectVisit") - .WithMany() - .HasForeignKey("LatestSubjectVisitId"); - - b.Navigation("FinalSubjectVisit"); - - b.Navigation("LatestSubjectVisit"); - }); - - 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.Dictionary", b => - { - b.Navigation("ChildList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Navigation("SubejectVisitList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Navigation("TestNewList"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912054434_RemoveForeignKey.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912054434_RemoveForeignKey.Designer.cs deleted file mode 100644 index 7cbf95b93..000000000 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912054434_RemoveForeignKey.Designer.cs +++ /dev/null @@ -1,456 +0,0 @@ -// -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("20240912054434_RemoveForeignKey")] - partial class RemoveForeignKey - { - /// - 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.Dictionary", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("ConfigTypeId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ConfigTypeId"); - - b.HasIndex("ParentId"); - - b.ToTable("Dictionary"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("ProjectUser"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("ReadModule"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReadingId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ReadingId"); - - b.ToTable("ReadingClinicalData"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("SubjectId"); - - b.ToTable("SubejectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("FinalSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("LatestSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("FinalSubjectVisitId"); - - b.HasIndex("LatestSubjectVisitId"); - - b.ToTable("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TrialImageDownloadId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TrialImageDownloadId"); - - b.ToTable("TestNew"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestStringLength", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DefaultLength") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserDefineLength") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("UserDefineText") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("TestStringLength"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DownloadEndTime") - .HasColumnType("datetime2"); - - b.Property("DownloadStartTime") - .HasColumnType("datetime2"); - - b.Property("ImageCount") - .HasColumnType("int"); - - b.Property("ImageSize") - .HasColumnType("bigint"); - - b.Property("ImageType") - .HasColumnType("int"); - - b.Property("IsSuccess") - .HasColumnType("bit"); - - b.Property("SubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("TrialImageDownload"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "ConfigType") - .WithMany() - .HasForeignKey("ConfigTypeId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "Parent") - .WithMany("ChildList") - .HasForeignKey("ParentId"); - - b.Navigation("ConfigType"); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Project"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", "ReadModule") - .WithMany() - .HasForeignKey("ReadingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "SubjectVisit") - .WithMany() - .HasForeignKey("ReadingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ReadModule"); - - b.Navigation("SubjectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject") - .WithMany("SubejectVisitList") - .HasForeignKey("SubjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "FinalSubjectVisit") - .WithMany() - .HasForeignKey("FinalSubjectVisitId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "LatestSubjectVisit") - .WithMany() - .HasForeignKey("LatestSubjectVisitId"); - - b.Navigation("FinalSubjectVisit"); - - b.Navigation("LatestSubjectVisit"); - }); - - 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.Dictionary", b => - { - b.Navigation("ChildList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Navigation("SubejectVisitList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Navigation("TestNewList"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912064923_RemoveForeignKey.Designer.cs similarity index 68% rename from IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.Designer.cs rename to IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912064923_RemoveForeignKey.Designer.cs index b4dbb3787..96bc1769f 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910053652_testAdd.Designer.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912064923_RemoveForeignKey.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations { [DbContext(typeof(IRCContext))] - [Migration("20240910053652_testAdd")] - partial class testAdd + [Migration("20240912064923_RemoveForeignKey")] + partial class RemoveForeignKey { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -25,9 +25,10 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("CreateTime") @@ -36,11 +37,6 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.Property("CreateUserId") .HasColumnType("uniqueidentifier"); - b.Property("TestName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - b.Property("UpdateTime") .HasColumnType("datetime2"); @@ -49,12 +45,13 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasKey("Id"); - b.ToTable("TestNew"); + b.ToTable("Project"); }); - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("CreateTime") @@ -63,25 +60,7 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.Property("CreateUserId") .HasColumnType("uniqueidentifier"); - b.Property("DownloadEndTime") - .HasColumnType("datetime2"); - - b.Property("DownloadStartTime") - .HasColumnType("datetime2"); - - b.Property("ImageCount") - .HasColumnType("int"); - - b.Property("ImageSize") - .HasColumnType("bigint"); - - b.Property("ImageType") - .HasColumnType("int"); - - b.Property("IsSuccess") - .HasColumnType("bit"); - - b.Property("SubjectVisitId") + b.Property("ProjectId") .HasColumnType("uniqueidentifier"); b.Property("UpdateTime") @@ -92,7 +71,20 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasKey("Id"); - b.ToTable("TrialImageDownload"); + b.HasIndex("ProjectId"); + + b.ToTable("ProjectUser"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); }); #pragma warning restore 612, 618 } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912054434_RemoveForeignKey.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912064923_RemoveForeignKey.cs similarity index 100% rename from IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912054434_RemoveForeignKey.cs rename to IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912064923_RemoveForeignKey.cs diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912065315_ForeignKey.Designer.cs similarity index 62% rename from IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs rename to IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912065315_ForeignKey.Designer.cs index 760de65c8..6efa54c98 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912065315_ForeignKey.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations { [DbContext(typeof(IRCContext))] - [Migration("20240910055957_navigateTest")] - partial class navigateTest + [Migration("20240912065315_ForeignKey")] + partial class ForeignKey { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -25,9 +25,10 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("CreateTime") @@ -36,14 +37,6 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.Property("CreateUserId") .HasColumnType("uniqueidentifier"); - b.Property("TestName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TrialImageDownloadId") - .HasColumnType("uniqueidentifier"); - b.Property("UpdateTime") .HasColumnType("datetime2"); @@ -52,14 +45,13 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasKey("Id"); - b.HasIndex("TrialImageDownloadId"); - - b.ToTable("TestNew"); + b.ToTable("Project"); }); - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("CreateTime") @@ -68,25 +60,7 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.Property("CreateUserId") .HasColumnType("uniqueidentifier"); - b.Property("DownloadEndTime") - .HasColumnType("datetime2"); - - b.Property("DownloadStartTime") - .HasColumnType("datetime2"); - - b.Property("ImageCount") - .HasColumnType("int"); - - b.Property("ImageSize") - .HasColumnType("bigint"); - - b.Property("ImageType") - .HasColumnType("int"); - - b.Property("IsSuccess") - .HasColumnType("bit"); - - b.Property("SubjectVisitId") + b.Property("ProjectId") .HasColumnType("uniqueidentifier"); b.Property("UpdateTime") @@ -97,21 +71,59 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasKey("Id"); - b.ToTable("TrialImageDownload"); + b.HasIndex("ProjectId"); + + b.ToTable("ProjectUser"); }); - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser2", b => { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", null) - .WithMany("TestNewList") - .HasForeignKey("TrialImageDownloadId") + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectUser2"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Project"); }); - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser2", b => { - b.Navigation("TestNewList"); + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); }); #pragma warning restore 612, 618 } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911144206_teststr.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912065315_ForeignKey.cs similarity index 54% rename from IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911144206_teststr.cs rename to IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912065315_ForeignKey.cs index f479cf60c..70639e2d1 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911144206_teststr.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912065315_ForeignKey.cs @@ -6,19 +6,17 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations { /// - public partial class teststr : Migration + public partial class ForeignKey : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( - name: "TestStringLength", + name: "ProjectUser2", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - DefaultLength = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - UserDefineLength = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false), - UserDefineText = table.Column(type: "text", maxLength: 200, nullable: false), + ProjectId = table.Column(type: "uniqueidentifier", nullable: false), CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), CreateTime = table.Column(type: "datetime2", nullable: false), UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false), @@ -26,15 +24,31 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations }, constraints: table => { - table.PrimaryKey("PK_TestStringLength", x => x.Id); + table.PrimaryKey("PK_ProjectUser2", x => x.Id); + table.ForeignKey( + name: "FK_ProjectUser2_Project_ProjectId", + column: x => x.ProjectId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); }); + + migrationBuilder.CreateIndex( + name: "IX_ProjectUser2_ProjectId", + table: "ProjectUser2", + column: "ProjectId"); + + migrationBuilder.RenameColumn( + name: "OldColumnName", + table: "YourTableName", + newName: "NewColumnName"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( - name: "TestStringLength"); + name: "ProjectUser2"); } } } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912072724_addField.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912072724_addField.Designer.cs new file mode 100644 index 000000000..ca271c8d5 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912072724_addField.Designer.cs @@ -0,0 +1,141 @@ +// +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("20240912072724_addField")] + partial class addField + { + /// + 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.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectUser"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser2", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectUser2"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser2", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912072724_addField.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912072724_addField.cs new file mode 100644 index 000000000..d9b40bfb5 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240912072724_addField.cs @@ -0,0 +1,42 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + /// + public partial class addField : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Code", + table: "ProjectUser", + type: "nvarchar(200)", + maxLength: 200, + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "Name", + table: "ProjectUser", + type: "nvarchar(200)", + maxLength: 200, + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Code", + table: "ProjectUser"); + + migrationBuilder.DropColumn( + name: "Name", + table: "ProjectUser"); + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs index 8a0151aca..2a1d0e054 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs @@ -22,44 +22,6 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("ConfigTypeId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ParentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ConfigTypeId"); - - b.HasIndex("ParentId"); - - b.ToTable("Dictionary"); - }); - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", b => { b.Property("Id") @@ -80,10 +42,48 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasKey("Id"); - b.ToTable("Project"); + b.ToTable("Project", (string)null); }); modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectUser", (string)null); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser2", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -108,264 +108,7 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasIndex("ProjectId"); - b.ToTable("ProjectUser"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("ReadModule"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReadingId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ReadingId"); - - b.ToTable("ReadingClinicalData"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("SubjectId"); - - b.ToTable("SubejectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("FinalSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("LatestSubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("FinalSubjectVisitId"); - - b.HasIndex("LatestSubjectVisitId"); - - b.ToTable("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TrialImageDownloadId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TrialImageDownloadId"); - - b.ToTable("TestNew"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestStringLength", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DefaultLength") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserDefineLength") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("UserDefineText") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("TestStringLength"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DownloadEndTime") - .HasColumnType("datetime2"); - - b.Property("DownloadStartTime") - .HasColumnType("datetime2"); - - b.Property("ImageCount") - .HasColumnType("int"); - - b.Property("ImageSize") - .HasColumnType("bigint"); - - b.Property("ImageType") - .HasColumnType("int"); - - b.Property("IsSuccess") - .HasColumnType("bit"); - - b.Property("SubjectVisitId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("TrialImageDownload"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "ConfigType") - .WithMany() - .HasForeignKey("ConfigTypeId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", "Parent") - .WithMany("ChildList") - .HasForeignKey("ParentId"); - - b.Navigation("ConfigType"); - - b.Navigation("Parent"); + b.ToTable("ProjectUser2", (string)null); }); modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b => @@ -379,73 +122,15 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.Navigation("Project"); }); - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b => + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser2", b => { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", "ReadModule") + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", "Project") .WithMany() - .HasForeignKey("ReadingId") + .HasForeignKey("ProjectId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "SubjectVisit") - .WithMany() - .HasForeignKey("ReadingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ReadModule"); - - b.Navigation("SubjectVisit"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject") - .WithMany("SubejectVisitList") - .HasForeignKey("SubjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Subject"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "FinalSubjectVisit") - .WithMany() - .HasForeignKey("FinalSubjectVisitId"); - - b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", "LatestSubjectVisit") - .WithMany() - .HasForeignKey("LatestSubjectVisitId"); - - b.Navigation("FinalSubjectVisit"); - - b.Navigation("LatestSubjectVisit"); - }); - - 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.Dictionary", b => - { - b.Navigation("ChildList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b => - { - b.Navigation("SubejectVisitList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => - { - b.Navigation("TestNewList"); + b.Navigation("Project"); }); #pragma warning restore 612, 618 } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs index 6451992e6..876fedd1c 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs @@ -2,9 +2,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL { @@ -56,81 +53,81 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL } - public class Subject : BaseFullAuditEntity - { - public string Name { get; set; } + //public class Subject : BaseFullAuditEntity + //{ + // public string Name { get; set; } - public Guid? LatestSubjectVisitId { get; set; } + // public Guid? LatestSubjectVisitId { get; set; } - public Guid? FinalSubjectVisitId { get; set; } + // public Guid? FinalSubjectVisitId { get; set; } - #region 同时配置一对多,一对一 导航属性 + // #region 同时配置一对多,一对一 导航属性 - [ForeignKey("FinalSubjectVisitId")] - public SubejectVisit FinalSubjectVisit { get; set; } + // [ForeignKey("FinalSubjectVisitId")] + // public SubejectVisit FinalSubjectVisit { get; set; } - [ForeignKey("LatestSubjectVisitId")] - public SubejectVisit LatestSubjectVisit { get; set; } + // [ForeignKey("LatestSubjectVisitId")] + // public SubejectVisit LatestSubjectVisit { get; set; } - public List SubejectVisitList { get; set; } - #endregion + // public List SubejectVisitList { get; set; } + // #endregion - } + //} - public class SubejectVisit : BaseFullAuditEntity - { - public Subject Subject { get; set; } + //public class SubejectVisit : BaseFullAuditEntity + //{ + // public Subject Subject { get; set; } - public Guid SubjectId { get; set; } + // public Guid SubjectId { get; set; } - } + //} - public class Dictionary : BaseFullAuditEntity - { - #region 导航属性 - [ForeignKey("ConfigTypeId")] - public Dictionary ConfigType { get; set; } + //public class Dictionary : BaseFullAuditEntity + //{ + // #region 导航属性 + // [ForeignKey("ConfigTypeId")] + // public Dictionary ConfigType { get; set; } - [ForeignKey("ParentId")] - public Dictionary Parent { get; set; } + // [ForeignKey("ParentId")] + // public Dictionary Parent { get; set; } - public List ChildList { get; set; } = new List(); + // public List ChildList { get; set; } = new List(); - #endregion + // #endregion - public Guid? ParentId { get; set; } + // public Guid? ParentId { get; set; } - public Guid? ConfigTypeId { get; set; } + // public Guid? ConfigTypeId { get; set; } - public string Code { get; set; } - } + // public string Code { get; set; } + //} #region 一个外键 关联两个实体 - public class ReadingClinicalData : BaseFullAuditEntity - { - public string Code { get; set; } + //public class ReadingClinicalData : BaseFullAuditEntity + //{ + // public string Code { get; set; } - public Guid ReadingId { get; set; } + // public Guid ReadingId { get; set; } - [ForeignKey("ReadingId")] + // [ForeignKey("ReadingId")] - public SubejectVisit SubjectVisit { get; set; } + // public SubejectVisit SubjectVisit { get; set; } - [ForeignKey("ReadingId")] + // [ForeignKey("ReadingId")] - public ReadModule ReadModule { get; set; } - } + // public ReadModule ReadModule { get; set; } + //} - public class ReadModule : BaseFullAuditEntity - { - public string Name { get; set; } - } + //public class ReadModule : BaseFullAuditEntity + //{ + // public string Name { get; set; } + //} #endregion #region 测试 字符串默认长度配置 @@ -159,6 +156,22 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL } public class ProjectUser : BaseFullAuditEntity + { + public string Name2 { get; set; } + + public string OtherName { get; set; } + + public string Code { get; set; } + + + + //外键 + public Guid ProjectId { get; set; } + + public Project Project { get; set; } + } + + public class ProjectUser2 : BaseFullAuditEntity { //外键 public Guid ProjectId { get; set; }