Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
34faaaf231
|
@ -238,33 +238,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPost, Route("Study/PreArchiveStudy")]
|
|
||||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
|
||||||
public async Task<IResponseOutput> PreArchiveStudy(PreArchiveStudyCommand preArchiveStudyCommand,
|
|
||||||
[FromServices] IStudyService _studyService,
|
|
||||||
[FromServices] IRepository<StudyMonitor> _studyMonitorRepository)
|
|
||||||
{
|
|
||||||
|
|
||||||
var savedInfo = _studyService.GetSaveToDicomInfo(preArchiveStudyCommand.SubjectVisitId);
|
|
||||||
|
|
||||||
var studyMonitor = new StudyMonitor()
|
|
||||||
{
|
|
||||||
TrialId = savedInfo.TrialId,
|
|
||||||
SubjectId = savedInfo.SubjectId,
|
|
||||||
SubjectVisitId = savedInfo.SubjectVisitId,
|
|
||||||
|
|
||||||
IsSuccess = false,
|
|
||||||
UploadStartTime = DateTime.Now,
|
|
||||||
IsDicom = preArchiveStudyCommand.IsDicom,
|
|
||||||
IP = _userInfo.IP
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
var addEntity = await _studyMonitorRepository.AddAsync(studyMonitor, true);
|
|
||||||
|
|
||||||
return ResponseOutput.Ok(addEntity.Id);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>Dicom 归档</summary>
|
/// <summary>Dicom 归档</summary>
|
||||||
|
@ -446,7 +420,33 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
public string FileType { get; set; }
|
public string FileType { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[HttpPost, Route("Study/PreArchiveStudy")]
|
||||||
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
|
public async Task<IResponseOutput> PreArchiveStudy(PreArchiveStudyCommand preArchiveStudyCommand,
|
||||||
|
[FromServices] IStudyService _studyService,
|
||||||
|
[FromServices] IRepository<StudyMonitor> _studyMonitorRepository)
|
||||||
|
{
|
||||||
|
|
||||||
|
var savedInfo = _studyService.GetSaveToDicomInfo(preArchiveStudyCommand.SubjectVisitId);
|
||||||
|
|
||||||
|
var studyMonitor = new StudyMonitor()
|
||||||
|
{
|
||||||
|
TrialId = savedInfo.TrialId,
|
||||||
|
SubjectId = savedInfo.SubjectId,
|
||||||
|
SubjectVisitId = savedInfo.SubjectVisitId,
|
||||||
|
|
||||||
|
IsSuccess = false,
|
||||||
|
UploadStartTime = DateTime.Now,
|
||||||
|
IsDicom = preArchiveStudyCommand.IsDicom,
|
||||||
|
IP = _userInfo.IP
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var addEntity = await _studyMonitorRepository.AddAsync(studyMonitor, true);
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(addEntity.Id);
|
||||||
|
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上传非Dicom 文件 支持压缩包 多文件上传
|
/// 上传非Dicom 文件 支持压缩包 多文件上传
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1000,9 +1000,9 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
item.TrialSiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).TrialSiteId;
|
item.TrialSiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).TrialSiteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var list = excelList.Where(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.CRA).ToList();
|
||||||
|
|
||||||
|
await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, baseUrl, routeUrl, list);
|
||||||
await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, baseUrl, routeUrl, excelList.ToList());
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
|
|
@ -103,12 +103,12 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<IResponseOutput> DicomUploadInProgress(Guid trialId, string studyInstanceUid,Guid? visitTaskId)
|
public async Task<IResponseOutput> DicomUploadInProgress(Guid trialId, string studyInstanceUid, Guid? visitTaskId)
|
||||||
{
|
{
|
||||||
if(visitTaskId != null)
|
if (visitTaskId != null)
|
||||||
{
|
{
|
||||||
var cacheValue = _fusionCache.GetOrDefault<Guid>(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid));
|
var cacheValue = _fusionCache.GetOrDefault<Guid>(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid));
|
||||||
if (cacheValue != Guid.Empty && cacheValue !=_userInfo.Id)
|
if (cacheValue != Guid.Empty && cacheValue != _userInfo.Id)
|
||||||
{
|
{
|
||||||
//---当前已有人正在上传和归档该检查!
|
//---当前已有人正在上传和归档该检查!
|
||||||
return ResponseOutput.NotOk(StaticData.International("UploadDownLoad_ArchiveInProgress"));
|
return ResponseOutput.NotOk(StaticData.International("UploadDownLoad_ArchiveInProgress"));
|
||||||
|
@ -134,11 +134,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
public async Task<IResponseOutput> AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand)
|
public async Task<IResponseOutput> AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand)
|
||||||
{
|
{
|
||||||
//总数为0的检查不允许提交
|
|
||||||
if (incommand.Study.SeriesList.SelectMany(t => t.InstanceList).Count() == 0)
|
|
||||||
{
|
|
||||||
return ResponseOutput.NotOk("Study_InstanceCountZero");
|
|
||||||
}
|
|
||||||
|
|
||||||
var @uploadLock = _distributedLockProvider.CreateLock($"UploadDicom");
|
var @uploadLock = _distributedLockProvider.CreateLock($"UploadDicom");
|
||||||
|
|
||||||
|
@ -163,7 +159,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
var trialId = incommand.TrialId;
|
var trialId = incommand.TrialId;
|
||||||
|
|
||||||
|
|
||||||
var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == incommand.StudyMonitorId);
|
var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == incommand.StudyMonitorId);
|
||||||
studyMonitor.UploadFinishedTime = DateTime.Now;
|
studyMonitor.UploadFinishedTime = DateTime.Now;
|
||||||
studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
||||||
|
@ -171,10 +166,36 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
studyMonitor.IsSuccess = incommand.FailedFileCount == 0;
|
studyMonitor.IsSuccess = incommand.FailedFileCount == 0;
|
||||||
studyMonitor.RecordPath = incommand.RecordPath;
|
studyMonitor.RecordPath = incommand.RecordPath;
|
||||||
|
|
||||||
|
var studyId = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString());
|
||||||
|
var findStudy = await _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == studyId);
|
||||||
|
|
||||||
|
studyMonitor.StudyId = studyId;
|
||||||
|
studyMonitor.StudyCode = findStudy?.StudyCode??"";
|
||||||
|
|
||||||
|
|
||||||
|
if (incommand.Study.SeriesList.SelectMany(t => t.InstanceList).Count() == 0)
|
||||||
|
{
|
||||||
|
await _studyMonitorRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
//上传
|
//上传
|
||||||
if (studyMonitor.IsDicomReUpload == false)
|
if (studyMonitor.IsDicomReUpload == false)
|
||||||
{
|
{
|
||||||
var study = _mapper.Map<DicomStudy>(incommand.Study);
|
|
||||||
|
//如果因为意外情况,连续点击两次,导致第一次插入了,第二次进来也会插入,在此判断一下
|
||||||
|
if (findStudy != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
await _studyMonitorRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
//直接返回
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var addStudy = _mapper.Map<DicomStudy>(incommand.Study);
|
||||||
|
|
||||||
var @lock = _distributedLockProvider.CreateLock($"StudyCode");
|
var @lock = _distributedLockProvider.CreateLock($"StudyCode");
|
||||||
|
|
||||||
|
@ -188,42 +209,34 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
int currentNextCodeInt = cacheMaxCodeInt > dbStudyCodeIntMax ? cacheMaxCodeInt + 1 : dbStudyCodeIntMax + 1;
|
int currentNextCodeInt = cacheMaxCodeInt > dbStudyCodeIntMax ? cacheMaxCodeInt + 1 : dbStudyCodeIntMax + 1;
|
||||||
|
|
||||||
study.Code = currentNextCodeInt;
|
addStudy.Code = currentNextCodeInt;
|
||||||
|
|
||||||
study.StudyCode = AppSettings.GetCodeStr(currentNextCodeInt, nameof(DicomStudy));
|
addStudy.StudyCode = AppSettings.GetCodeStr(currentNextCodeInt, nameof(DicomStudy));
|
||||||
|
|
||||||
await _fusionCache.SetAsync<int>(CacheKeys.TrialStudyMaxCode(trialId), study.Code, TimeSpan.FromMinutes(30));
|
await _fusionCache.SetAsync<int>(CacheKeys.TrialStudyMaxCode(trialId), addStudy.Code, TimeSpan.FromMinutes(30));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
study.Id = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString());
|
addStudy.Id = studyId;
|
||||||
study.TrialId = incommand.TrialId;
|
addStudy.TrialId = incommand.TrialId;
|
||||||
study.SubjectId = incommand.SubjectId;
|
addStudy.SubjectId = incommand.SubjectId;
|
||||||
study.SubjectVisitId = incommand.SubjectVisitId;
|
addStudy.SubjectVisitId = incommand.SubjectVisitId;
|
||||||
study.IsFromPACS = false;
|
addStudy.IsFromPACS = false;
|
||||||
|
|
||||||
//如果因为意外情况,连续点击两次,导致第一次插入了,第二次进来也会插入,在此判断一下
|
|
||||||
var findStudy = await _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == study.Id);
|
|
||||||
|
|
||||||
if (findStudy != null)
|
|
||||||
{
|
|
||||||
//直接返回
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//特殊处理逻辑
|
//特殊处理逻辑
|
||||||
study.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Distinct());
|
addStudy.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Distinct());
|
||||||
SpecialArchiveStudyDeal(study);
|
SpecialArchiveStudyDeal(addStudy);
|
||||||
modalitys = study.Modalities;
|
modalitys = addStudy.Modalities;
|
||||||
|
|
||||||
await _dicomstudyRepository.AddAsync(study);
|
await _dicomstudyRepository.AddAsync(addStudy);
|
||||||
|
|
||||||
|
|
||||||
studyMonitor.StudyId = study.Id;
|
|
||||||
studyMonitor.StudyCode = study.StudyCode;
|
studyMonitor.StudyCode = addStudy.StudyCode;
|
||||||
|
|
||||||
|
|
||||||
foreach (var seriesItem in incommand.Study.SeriesList)
|
foreach (var seriesItem in incommand.Study.SeriesList)
|
||||||
|
@ -231,7 +244,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
var series = _mapper.Map<DicomSeries>(seriesItem);
|
var series = _mapper.Map<DicomSeries>(seriesItem);
|
||||||
|
|
||||||
series.Id = IdentifierHelper.CreateGuid(seriesItem.StudyInstanceUid, seriesItem.SeriesInstanceUid, incommand.TrialId.ToString());
|
series.Id = IdentifierHelper.CreateGuid(seriesItem.StudyInstanceUid, seriesItem.SeriesInstanceUid, incommand.TrialId.ToString());
|
||||||
series.StudyId = study.Id;
|
series.StudyId = addStudy.Id;
|
||||||
|
|
||||||
series.TrialId = incommand.TrialId;
|
series.TrialId = incommand.TrialId;
|
||||||
series.SubjectId = incommand.SubjectId;
|
series.SubjectId = incommand.SubjectId;
|
||||||
|
@ -246,10 +259,10 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
var isntance = _mapper.Map<DicomInstance>(instanceItem);
|
var isntance = _mapper.Map<DicomInstance>(instanceItem);
|
||||||
|
|
||||||
Guid instanceId = IdentifierHelper.CreateGuid(study.StudyInstanceUid, series.SeriesInstanceUid, isntance.SopInstanceUid, study.TrialId.ToString());
|
Guid instanceId = IdentifierHelper.CreateGuid(addStudy.StudyInstanceUid, series.SeriesInstanceUid, isntance.SopInstanceUid, addStudy.TrialId.ToString());
|
||||||
|
|
||||||
isntance.Id = instanceId;
|
isntance.Id = instanceId;
|
||||||
isntance.StudyId = study.Id;
|
isntance.StudyId = addStudy.Id;
|
||||||
isntance.SeriesId = series.Id;
|
isntance.SeriesId = series.Id;
|
||||||
|
|
||||||
isntance.TrialId = incommand.TrialId;
|
isntance.TrialId = incommand.TrialId;
|
||||||
|
@ -260,26 +273,15 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
var studyId = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString()); ;
|
|
||||||
|
|
||||||
var study = await _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == studyId);
|
|
||||||
|
|
||||||
//重传的时候也要赋值检查Id
|
|
||||||
studyMonitor.StudyId = study.Id;
|
|
||||||
studyMonitor.StudyCode = study.StudyCode;
|
|
||||||
|
|
||||||
//特殊处理逻辑
|
//特殊处理逻辑
|
||||||
study.IsFromPACS = false;
|
findStudy.IsFromPACS = false;
|
||||||
study.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Union(study.Modalities.Split("、", StringSplitOptions.RemoveEmptyEntries)).Distinct());
|
findStudy.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Union(findStudy.Modalities.Split("、", StringSplitOptions.RemoveEmptyEntries)).Distinct());
|
||||||
SpecialArchiveStudyDeal(study);
|
SpecialArchiveStudyDeal(findStudy);
|
||||||
modalitys = study.Modalities;
|
modalitys = findStudy.Modalities;
|
||||||
|
|
||||||
|
|
||||||
// 少了整个序列
|
// 少了整个序列
|
||||||
|
@ -297,7 +299,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
var series = _mapper.Map<DicomSeries>(seriesItem);
|
var series = _mapper.Map<DicomSeries>(seriesItem);
|
||||||
|
|
||||||
series.Id = seriesId;
|
series.Id = seriesId;
|
||||||
series.StudyId = study.Id;
|
series.StudyId = findStudy.Id;
|
||||||
|
|
||||||
series.TrialId = incommand.TrialId;
|
series.TrialId = incommand.TrialId;
|
||||||
series.SubjectId = incommand.SubjectId;
|
series.SubjectId = incommand.SubjectId;
|
||||||
|
@ -307,7 +309,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
dicomSeries = await _dicomSeriesRepository.AddAsync(series);
|
dicomSeries = await _dicomSeriesRepository.AddAsync(series);
|
||||||
|
|
||||||
//新的序列 那么 检查的序列数量+1
|
//新的序列 那么 检查的序列数量+1
|
||||||
study.SeriesCount += 1;
|
findStudy.SeriesCount += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -319,7 +321,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
var insntance = _mapper.Map<DicomInstance>(instanceItem);
|
var insntance = _mapper.Map<DicomInstance>(instanceItem);
|
||||||
insntance.Id = IdentifierHelper.CreateGuid(insntance.StudyInstanceUid, insntance.SeriesInstanceUid, insntance.SopInstanceUid, trialId.ToString());
|
insntance.Id = IdentifierHelper.CreateGuid(insntance.StudyInstanceUid, insntance.SeriesInstanceUid, insntance.SopInstanceUid, trialId.ToString());
|
||||||
insntance.StudyId = study.Id;
|
insntance.StudyId = findStudy.Id;
|
||||||
insntance.SeriesId = dicomSeries.Id;
|
insntance.SeriesId = dicomSeries.Id;
|
||||||
|
|
||||||
insntance.TrialId = incommand.TrialId;
|
insntance.TrialId = incommand.TrialId;
|
||||||
|
@ -331,7 +333,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
|
|
||||||
// 不管是新的序列 还是 该序列 掉了Instance 重传的时候 检查的instance 数量都会增加
|
// 不管是新的序列 还是 该序列 掉了Instance 重传的时候 检查的instance 数量都会增加
|
||||||
study.InstanceCount += seriesItem.InstanceList.Count;
|
findStudy.InstanceCount += seriesItem.InstanceList.Count;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -934,6 +934,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
saveItem.UserName = saveItem.UserCode;
|
saveItem.UserName = saveItem.UserCode;
|
||||||
|
|
||||||
|
//saveItem.UserTypeEnum = _userTypeRepository.Where(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First();
|
||||||
|
|
||||||
var newUser = _userRepository.AddAsync(saveItem).Result;
|
var newUser = _userRepository.AddAsync(saveItem).Result;
|
||||||
|
|
||||||
_ = _userRepository.SaveChangesAsync().Result;
|
_ = _userRepository.SaveChangesAsync().Result;
|
||||||
|
|
|
@ -251,10 +251,8 @@ namespace IRaCIS.Core.Application.Services
|
||||||
HtmlPath = k.HtmlPath,
|
HtmlPath = k.HtmlPath,
|
||||||
Path = k.Path,
|
Path = k.Path,
|
||||||
InstanceNumber = k.InstanceNumber,
|
InstanceNumber = k.InstanceNumber,
|
||||||
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//设置为阅片与否 不更改数据库检查 的instance数量 和 SeriesCount 所以这里要实时统计
|
//设置为阅片与否 不更改数据库检查 的instance数量 和 SeriesCount 所以这里要实时统计
|
||||||
|
|
|
@ -44,7 +44,9 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
public enum ImageType
|
public enum ImageType
|
||||||
{
|
{
|
||||||
Dicom = 1,
|
Dicom = 1,
|
||||||
|
|
||||||
NoneDicom = 2,
|
NoneDicom = 2,
|
||||||
|
|
||||||
DicomAndNoneDicom = 3
|
DicomAndNoneDicom = 3
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Efcore 最新支持批量配置字符串类型长度作为保底的 官网参考:https://learn.microsoft.com/zh-cn/ef/core/modeling/bulk-configuration#conventions
|
||||||
|
/// </summary>
|
||||||
|
public class MaxStringLengthConvention : IModelFinalizingConvention
|
||||||
|
{
|
||||||
|
public void ProcessModelFinalizing(IConventionModelBuilder modelBuilder, IConventionContext<IConventionModelBuilder> context)
|
||||||
|
{
|
||||||
|
foreach (var property in modelBuilder.Metadata.GetEntityTypes()
|
||||||
|
.SelectMany(
|
||||||
|
entityType => entityType.GetDeclaredProperties()
|
||||||
|
.Where(
|
||||||
|
property => property.ClrType == typeof(string))))
|
||||||
|
{
|
||||||
|
property.Builder.HasMaxLength(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Convention
|
||||||
|
{
|
||||||
|
public class MigrationRemoveForeignKeysSqlGenerator : MigrationsSqlGenerator
|
||||||
|
{
|
||||||
|
public MigrationRemoveForeignKeysSqlGenerator(MigrationsSqlGeneratorDependencies dependencies, IMigrationsAnnotationProvider migrationsAnnotations) : base(dependencies)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Generate(Microsoft.EntityFrameworkCore.Migrations.Operations.CreateTableOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true)
|
||||||
|
{
|
||||||
|
operation.ForeignKeys.Clear();
|
||||||
|
base.Generate(operation, model, builder, terminate);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Generate(AddForeignKeyOperation operation, IModel? model, MigrationCommandListBuilder builder,
|
||||||
|
bool terminate = true)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,10 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
||||||
|
using IRaCIS.Core.Test.CodeFirstTest.MSSQL.Convention;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
||||||
|
|
||||||
|
@ -30,8 +33,20 @@ public partial class IRCContext : DbContext
|
||||||
public virtual DbSet<ReadingClinicalData> ReadingClinicalData { get; set; }
|
public virtual DbSet<ReadingClinicalData> ReadingClinicalData { get; set; }
|
||||||
public virtual DbSet<ReadModule> ReadModule { get; set; }
|
public virtual DbSet<ReadModule> ReadModule { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<TestStringLength> TestStringLength { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Project> Project { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<ProjectUser> ProjectUser { get; set; }
|
||||||
|
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
=> optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=IRC_Code;User ID=sa;Password=mssql_KnTs2a;TrustServerCertificate=true");
|
{
|
||||||
|
optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=IRC_Code;User ID=sa;Password=mssql_KnTs2a;TrustServerCertificate=true");
|
||||||
|
|
||||||
|
//移除外键约束
|
||||||
|
optionsBuilder.ReplaceService<IMigrationsSqlGenerator, MigrationRemoveForeignKeysSqlGenerator>();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
@ -44,8 +59,14 @@ public partial class IRCContext : DbContext
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OnModelCreatingPartial(modelBuilder);
|
OnModelCreatingPartial(modelBuilder);
|
||||||
}
|
}
|
||||||
|
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
|
||||||
|
{
|
||||||
|
//针对字符串使用默认的长度配置
|
||||||
|
configurationBuilder.Conventions.Add(_ => new MaxStringLengthConvention());
|
||||||
|
}
|
||||||
|
|
||||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
356
IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.Designer.cs
generated
Normal file
356
IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911143331_testMaxLength.Designer.cs
generated
Normal file
|
@ -0,0 +1,356 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(IRCContext))]
|
||||||
|
[Migration("20240911143331_testMaxLength")]
|
||||||
|
partial class testMaxLength
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.8")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ConfigTypeId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ParentId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ReadModule");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("ReadingId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ReadingId");
|
||||||
|
|
||||||
|
b.ToTable("ReadingClinicalData");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("SubjectId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SubjectId");
|
||||||
|
|
||||||
|
b.ToTable("SubejectVisit");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("FinalSubjectVisitId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("LatestSubjectVisitId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("TestName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("nvarchar(100)");
|
||||||
|
|
||||||
|
b.Property<Guid>("TrialImageDownloadId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TrialImageDownloadId");
|
||||||
|
|
||||||
|
b.ToTable("TestNew");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DownloadEndTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DownloadStartTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("ImageCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<long>("ImageSize")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("ImageType")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("IsSuccess")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("SubjectVisitId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("TrialImageDownload");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class testMaxLength : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Subject",
|
||||||
|
type: "nvarchar(200)",
|
||||||
|
maxLength: 200,
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(max)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
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<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ReadModule", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ReadingClinicalData",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Code = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
||||||
|
ReadingId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(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");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ReadingClinicalData");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ReadModule");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Subject",
|
||||||
|
type: "nvarchar(max)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(200)",
|
||||||
|
oldMaxLength: 200);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Code",
|
||||||
|
table: "Dictionary",
|
||||||
|
type: "nvarchar(max)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(200)",
|
||||||
|
oldMaxLength: 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
394
IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911144206_teststr.Designer.cs
generated
Normal file
394
IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911144206_teststr.Designer.cs
generated
Normal file
|
@ -0,0 +1,394 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(IRCContext))]
|
||||||
|
[Migration("20240911144206_teststr")]
|
||||||
|
partial class teststr
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.8")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ConfigTypeId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ParentId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ReadModule");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("ReadingId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ReadingId");
|
||||||
|
|
||||||
|
b.ToTable("ReadingClinicalData");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("SubjectId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SubjectId");
|
||||||
|
|
||||||
|
b.ToTable("SubejectVisit");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("FinalSubjectVisitId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("LatestSubjectVisitId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("TestName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("nvarchar(100)");
|
||||||
|
|
||||||
|
b.Property<Guid>("TrialImageDownloadId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TrialImageDownloadId");
|
||||||
|
|
||||||
|
b.ToTable("TestNew");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestStringLength", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("DefaultLength")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("UserDefineLength")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(300)
|
||||||
|
.HasColumnType("nvarchar(300)");
|
||||||
|
|
||||||
|
b.Property<string>("UserDefineText")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("TestStringLength");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DownloadEndTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DownloadStartTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("ImageCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<long>("ImageSize")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("ImageType")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("IsSuccess")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("SubjectVisitId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("TrialImageDownload");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class teststr : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "TestStringLength",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
DefaultLength = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
||||||
|
UserDefineLength = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: false),
|
||||||
|
UserDefineText = table.Column<string>(type: "text", maxLength: 200, nullable: false),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_TestStringLength", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "TestStringLength");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
456
IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911151956_RemoveForeignKeys.Designer.cs
generated
Normal file
456
IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240911151956_RemoveForeignKeys.Designer.cs
generated
Normal file
|
@ -0,0 +1,456 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(IRCContext))]
|
||||||
|
[Migration("20240911151956_RemoveForeignKeys")]
|
||||||
|
partial class RemoveForeignKeys
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.8")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ConfigTypeId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ParentId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Project");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProjectId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProjectId");
|
||||||
|
|
||||||
|
b.ToTable("ProjectUser");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ReadModule");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("ReadingId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ReadingId");
|
||||||
|
|
||||||
|
b.ToTable("ReadingClinicalData");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("SubjectId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SubjectId");
|
||||||
|
|
||||||
|
b.ToTable("SubejectVisit");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("FinalSubjectVisitId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("LatestSubjectVisitId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("TestName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("nvarchar(100)");
|
||||||
|
|
||||||
|
b.Property<Guid>("TrialImageDownloadId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TrialImageDownloadId");
|
||||||
|
|
||||||
|
b.ToTable("TestNew");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestStringLength", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("DefaultLength")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("UserDefineLength")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(300)
|
||||||
|
.HasColumnType("nvarchar(300)");
|
||||||
|
|
||||||
|
b.Property<string>("UserDefineText")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("TestStringLength");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DownloadEndTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DownloadStartTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("ImageCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<long>("ImageSize")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("ImageType")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("IsSuccess")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("SubjectVisitId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("TrialImageDownload");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class RemoveForeignKeys : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Project",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Project", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ProjectUser",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
ProjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ProjectUser", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ProjectUser_Project_ProjectId",
|
||||||
|
column: x => x.ProjectId,
|
||||||
|
principalTable: "Project",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ProjectUser_ProjectId",
|
||||||
|
table: "ProjectUser",
|
||||||
|
column: "ProjectId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ProjectUser");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Project");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,11 +25,13 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b =>
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Code")
|
b.Property<string>("Code")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
b.Property<Guid?>("ConfigTypeId")
|
b.Property<Guid?>("ConfigTypeId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
@ -55,12 +57,125 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
|
||||||
b.HasIndex("ParentId");
|
b.HasIndex("ParentId");
|
||||||
|
|
||||||
b.ToTable("Dictionary", (string)null);
|
b.ToTable("Dictionary");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Project", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Project");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ProjectUser", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProjectId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProjectId");
|
||||||
|
|
||||||
|
b.ToTable("ProjectUser");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadModule", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ReadModule");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.ReadingClinicalData", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("ReadingId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ReadingId");
|
||||||
|
|
||||||
|
b.ToTable("ReadingClinicalData");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b =>
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreateTime")
|
b.Property<DateTime>("CreateTime")
|
||||||
|
@ -82,12 +197,13 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
|
||||||
b.HasIndex("SubjectId");
|
b.HasIndex("SubjectId");
|
||||||
|
|
||||||
b.ToTable("SubejectVisit", (string)null);
|
b.ToTable("SubejectVisit");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b =>
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreateTime")
|
b.Property<DateTime>("CreateTime")
|
||||||
|
@ -104,7 +220,8 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
b.Property<DateTime>("UpdateTime")
|
b.Property<DateTime>("UpdateTime")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
@ -118,12 +235,13 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
|
||||||
b.HasIndex("LatestSubjectVisitId");
|
b.HasIndex("LatestSubjectVisitId");
|
||||||
|
|
||||||
b.ToTable("Subject", (string)null);
|
b.ToTable("Subject");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b =>
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreateTime")
|
b.Property<DateTime>("CreateTime")
|
||||||
|
@ -150,12 +268,51 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
|
||||||
b.HasIndex("TrialImageDownloadId");
|
b.HasIndex("TrialImageDownloadId");
|
||||||
|
|
||||||
b.ToTable("TestNew", (string)null);
|
b.ToTable("TestNew");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestStringLength", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("DefaultLength")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("UserDefineLength")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(300)
|
||||||
|
.HasColumnType("nvarchar(300)");
|
||||||
|
|
||||||
|
b.Property<string>("UserDefineText")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("TestStringLength");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreateTime")
|
b.Property<DateTime>("CreateTime")
|
||||||
|
@ -193,7 +350,7 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("TrialImageDownload", (string)null);
|
b.ToTable("TrialImageDownload");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b =>
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Dictionary", b =>
|
||||||
|
@ -211,6 +368,36 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
|
||||||
b.Navigation("Parent");
|
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 =>
|
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject")
|
b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", "Subject")
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using IRaCIS.Core.Domain.Models;
|
using System;
|
||||||
using IRaCIS.Core.Domain.Share;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
@ -10,6 +8,15 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
|
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
|
||||||
{
|
{
|
||||||
|
public abstract class BaseFullAuditEntity
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public Guid CreateUserId { get; set; }
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
public Guid UpdateUserId { get; set; }
|
||||||
|
public DateTime UpdateTime { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[Table("TrialImageDownload")]
|
[Table("TrialImageDownload")]
|
||||||
public class TrialImageDownload : BaseFullAuditEntity
|
public class TrialImageDownload : BaseFullAuditEntity
|
||||||
|
@ -126,6 +133,34 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 测试 字符串默认长度配置
|
||||||
|
|
||||||
|
public class TestStringLength : BaseFullAuditEntity
|
||||||
|
{
|
||||||
|
public string DefaultLength { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(300)]
|
||||||
|
public string UserDefineLength { get; set; }
|
||||||
|
|
||||||
|
[Column(TypeName = "text")]
|
||||||
|
public string UserDefineText { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 测试生成迁移移除外键约束
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
public class Project : BaseFullAuditEntity
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProjectUser: BaseFullAuditEntity
|
||||||
|
{
|
||||||
|
//外键
|
||||||
|
public Guid ProjectId { get; set; }
|
||||||
|
|
||||||
|
public Project Project { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue