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

IRC_NewDev
hang 2024-09-10 20:28:52 +08:00
commit ecbc27fbb8
40 changed files with 1608 additions and 168 deletions

View File

@ -15,15 +15,16 @@
"ObjectStoreUse": "AliyunOSS",
"AliyunOSS": {
"regionId": "cn-shanghai",
"internalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
"endpoint": "https://oss-cn-shanghai.aliyuncs.com",
"accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ",
"accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio",
"bucketName": "zy-irc-uat-store",
"roleArn": "acs:ram::1899121822495495:role/oss-upload",
"viewEndpoint": "https://zy-irc-uat-store.oss-cn-shanghai.aliyuncs.com",
"region": "oss-cn-shanghai"
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
"EndPoint": "https://oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tJV76pYX5yPg1N9QVE8",
"AccessKeySecret": "roRNLa9YG1of4pYruJGCNKBXEWTAWa",
"BucketName": "zy-irc-uat-store",
"RoleArn": "acs:ram::1899121822495495:role/webdirect",
"ViewEndpoint": "https://zy-irc-uat-store.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
"MinIO": {
@ -38,6 +39,17 @@
"secretKey": "DzMaU2L4OXl90uytwOmDXF2encN0Jf4Nxu2XkYqQ",
"bucketName": "irc-uat"
},
"AWS": {
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
"UseSSL": true,
"RoleArn": "arn:aws:iam::471112624751:role/sts_s3_upload",
"AccessKeyId": "AKIAW3MEAFJXWRCGSX5Z",
"SecretAccessKey": "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",
"BucketName": "ei-med-s3-lili-uat-store",
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com/",
"DurationSeconds": 7200
}
},

View File

@ -1002,11 +1002,12 @@
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.VerifyIRStudyAllowUpload(IRaCIS.Core.Application.Contracts.TaskStudyAchivePreConfirmCommand)">
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.VerifyIRStudyAllowUpload(IRaCIS.Core.Application.Contracts.TaskStudyAchivePreConfirmCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy})">
<summary>
在调用预归档前验证 这些检查是否可以全新上传还是已存在补充 目前前端允许 IsAllowUpload==true 全新、IsAllowReUpload==true 补充的study ,全部丢到后端,后端判断存在,就删除之前的检查,全新插入
</summary>
<param name="inCommand"></param>
<param name="_dicomStudyRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.GetIRUploadTaskNoneDicomStudyList(IRaCIS.Core.Application.Contracts.IRUploadStudyQuery)">
@ -6871,6 +6872,11 @@
答案分组
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetTrialCriterionJudgeQuestionListOutDto.Unit">
<summary>
单位
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetTrialCriterionJudgeQuestionListOutDto.AnswerCombination">
<summary>
答案组合

View File

@ -527,6 +527,8 @@ namespace IRaCIS.Core.Application.Contracts
[NotDefault]
public string SubjectCode { get; set; }
public Guid? VisitTaskId { get; set; }
}
@ -554,6 +556,6 @@ namespace IRaCIS.Core.Application.Contracts
{
public Guid SubjectVisitId { get; set; }
public Guid VisitTaskId { get; set; }
public Guid TaskId { get; set; }
}
}

View File

@ -256,18 +256,28 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
/// 在调用预归档前验证 这些检查是否可以全新上传还是已存在补充 目前前端允许 IsAllowUpload==true 全新、IsAllowReUpload==true 补充的study ,全部丢到后端,后端判断存在,就删除之前的检查,全新插入
/// </summary>
/// <param name="inCommand"></param>
/// <param name="_dicomStudyRepository"></param>
/// <returns></returns>
public async Task<List<TaskStudyArchiveConfirmResult>> VerifyIRStudyAllowUpload(TaskStudyAchivePreConfirmCommand inCommand)
public async Task<List<TaskStudyArchiveConfirmResult>> VerifyIRStudyAllowUpload(TaskStudyAchivePreConfirmCommand inCommand, [FromServices] IRepository<DicomStudy> _dicomStudyRepository)
{
var notAllowedUidList = _taskStudyRepository.Where(t => t.TrialId == inCommand.TrialId && inCommand.StudyInstanceUidList.Contains(t.StudyInstanceUid)).Select(t => new
var notAllowedUidList1 = _taskStudyRepository.Where(t => t.TrialId == inCommand.TrialId && inCommand.StudyInstanceUidList.Contains(t.StudyInstanceUid)).Select(t => new
{
t.StudyInstanceUid,
t.SubjectId,
SubejectCode = t.VisitTask.IsAnalysisCreate ? t.VisitTask.BlindSubjectCode : t.Subject.Code
}).ToList();
var notAllowedUidList2 = _dicomStudyRepository.Where(t => t.TrialId == inCommand.TrialId && inCommand.StudyInstanceUidList.Contains(t.StudyInstanceUid)).Select(t => new
{
t.StudyInstanceUid,
t.SubjectId,
SubejectCode = t.Subject.Code
}).ToList();
var notAllowedUidList = notAllowedUidList1.Union(notAllowedUidList2);
var result = new List<TaskStudyArchiveConfirmResult>();
foreach (var studyUid in inCommand.StudyInstanceUidList)
@ -275,6 +285,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
var findStudy = notAllowedUidList.Where(t => t.StudyInstanceUid == studyUid).FirstOrDefault();
if (findStudy != null)
{
//同一个subject 同一份影响
if (findStudy.SubejectCode == inCommand.SubjectCode && findStudy.SubjectId == inCommand.SubjectId)
{
@ -574,7 +585,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
}
else
{
await _noneDicomStudyFileReposiotry.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visitTaskId && t.NoneDicomStudyId == noneDicomStudyId);
await _noneDicomStudyFileReposiotry.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visitTaskId && t.OriginNoneDicomStudyId == noneDicomStudyId);
}
return ResponseOutput.Ok();
@ -590,9 +601,13 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
[HttpPost]
public async Task<List<TaskNoneDicomStudyDTO>> GetIRUploadTaskNoneDicomStudyList(IRUploadStudyQuery inQuery)
{
var info = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId)
.Select(t => new { t.IsImageFilter, t.CriterionModalitys }).FirstNotNullAsync();
var query = from u in _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId
&& t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect)
join ns in _noneDicomStudyReposiotry.Where(t => t.SubjectId == inQuery.SubjectId) on u.SourceSubjectVisitId equals ns.SubjectVisitId
join ns in _noneDicomStudyReposiotry.Where(t => t.SubjectId == inQuery.SubjectId).WhereIf(info.IsImageFilter,t=> ("|" + info.CriterionModalitys + "|").Contains("|" + t.Modality + "|"))
on u.SourceSubjectVisitId equals ns.SubjectVisitId
select new TaskNoneDicomStudyDTO()
{
@ -723,9 +738,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
[HttpPost]
public async Task<List<SubjectCRCImageUploadedStudyDto>> GetSubjectImageDownloadSelectList(IRReadingDownloadQuery inQuery)
{
var doctorUserId = _userInfo.Id;
//医学审核查看下载按钮,这个时候需要知道医生
if (inQuery.VisitTaskId != null && inQuery.VisitTaskId!=Guid.Empty)
{
doctorUserId = await _visitTaskRepository.Where(t => t.Id == inQuery.VisitTaskId).Select(t => (Guid)t.DoctorUserId).FirstNotNullAsync();
}
var query = _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId
&& t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect)
&& t.SourceSubjectVisitId != null && t.DoctorUserId == doctorUserId && t.TaskState == TaskState.Effect)
.ProjectTo<SubjectCRCImageUploadedDto>(_mapper.ConfigurationProvider);
@ -801,10 +823,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
var isQueryDicom = inQuery.DicomStudyIdList.Count > 0;
var isQueryNoneDicom = inQuery.NoneDicomStudyIdList.Count > 0;
var taskIdList = inQuery.SubjectVisitTaskList.Select(t => t.TaskId).ToList();
var subjectVisitIdList = inQuery.SubjectVisitTaskList.Select(t => t.SubjectVisitId).ToList();
//var a = _visitTaskRepository.Where(t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id);
var query = from sv in _subjectRepository.Where(t => t.Id == inQuery.SubjectId).SelectMany(t => t.SubjectVisitList.Where(t => subjectVisitIdList.Contains(t.Id)))
join visitTask in _visitTaskRepository.Where(t => t.TaskState == TaskState.Effect && t.DoctorUserId == _userInfo.Id && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
//一致性分析,导致查询出来两条数据
join visitTask in _visitTaskRepository.Where(t=> taskIdList.Contains(t.Id)) /*.Where(t => t.TaskState == TaskState.Effect && t.DoctorUserId == _userInfo.Id && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)*/
on sv.Id equals visitTask.SourceSubjectVisitId
select new
{

View File

@ -32,11 +32,11 @@ namespace IRaCIS.Core.Application.Contracts
[FromQuery, NotDefault] Guid subjectVisitId,
[FromQuery] Guid? nonedicomStudyId,
[FromQuery] bool isFilterZip,
[FromQuery] Guid? visiTaskId)
[FromQuery] Guid? visitTaskId)
{
IQueryable<NoneDicomStudyView> noneDicomStudyQueryable = default;
if (visiTaskId == null)
if (visitTaskId == null)
{
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId).WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId)
@ -44,9 +44,9 @@ namespace IRaCIS.Core.Application.Contracts
}
else
{
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.TaskNoneDicomFileList.Any(t => t.VisitTaskId == visiTaskId))
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.TaskNoneDicomFileList.Any(t => t.VisitTaskId == visitTaskId))
.WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId)
.ProjectTo<TaskDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, visiTaskId = visiTaskId });
.ProjectTo<TaskDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, visiTaskId = visitTaskId });
}

View File

@ -136,7 +136,8 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.FeedBackUserName, c => c.MapFrom(t => t.CreateUser.UserName))
.ForMember(d => d.FeedBackFullName, c => c.MapFrom(t => t.CreateUser.FullName))
.ForMember(d => d.UserTypeEnum, c => c.MapFrom(t => t.CreateUser.UserTypeEnum));
CreateMap<UserFeedBack, UserFeedBackAddOrEdit>().ReverseMap();
CreateMap<UserFeedBackAddOrEdit, UserFeedBack>().ReverseMap();
}
}

View File

@ -599,8 +599,9 @@ namespace IRaCIS.Core.Application.Service
Guid? visiTaskId = null;
CreateMap<NoneDicomStudy, TaskDicomStudyView>()
.ForMember(d => d.NoneDicomStudyFileList, u => u.MapFrom(s => isFilterZip ? s.TaskNoneDicomFileList.WhereIf(visiTaskId!=null,t=>t.VisitTaskId==visiTaskId)
.Where(t => !t.FileType.Contains(StaticData.FileType.Zip)) : s.TaskNoneDicomFileList.WhereIf(visiTaskId != null, t => t.VisitTaskId == visiTaskId)))
.ForMember(d => d.NoneDicomStudyFileList, u => u.MapFrom(s => isFilterZip ?
s.TaskNoneDicomFileList.Where(t=> visiTaskId != null?t.VisitTaskId==visiTaskId:true).Where(t => !t.FileType.Contains(StaticData.FileType.Zip))
: s.TaskNoneDicomFileList.Where(t => visiTaskId != null ? t.VisitTaskId == visiTaskId : true)))
.ForMember(d => d.CodeView, u => u.MapFrom(s => s.StudyCode));
}

View File

@ -1911,6 +1911,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public List<string> AnswerGroup { get; set; }
/// <summary>
/// 单位
/// </summary>
public ValueUnit? Unit { get; set; }
/// <summary>
/// 答案组合
/// </summary>

View File

@ -678,6 +678,7 @@ namespace IRaCIS.Core.Application.Service.RC
case CriterionType.OCT:
criterion.IsImageFilter = true;
criterion.IsReadingPeriod = false;
criterion.IsGlobalReading = false;
criterion.IsReadingTaskViewInOrder = ReadingOrder.SubjectRandom;
criterion.ImageDownloadEnum = ReadingImageDownload.Subejct;
criterion.ImageUploadEnum = ReadingImageUpload.IRReadingSubejctEnable;

View File

@ -47,6 +47,7 @@ namespace IRaCIS.Application.Services
DictionaryCode=x.DictionaryCode,
JudgeType = x.JudgeType,
Type=x.Type,
Unit= x.Unit,
ReadingQuestionTrialId = x.Id,
JudgeDifferenceValue= x.JudgeDifferenceValue,
JudgeDifferenceType=x.JudgeDifferenceType,

View File

@ -6,6 +6,7 @@ using Panda.DynamicWebApi.Attributes;
using IRaCIS.Core.Application.Contracts;
using MassTransit;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Domain.Models;
namespace IRaCIS.Application.Services
{
@ -66,7 +67,7 @@ namespace IRaCIS.Application.Services
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput<List<NoneDicomStudyView>> > GetReadingImageFile(GetReadingImgInDto inDto)
public async Task<IResponseOutput<List<NoneDicomStudyView>>> GetReadingImageFile(GetReadingImgInDto inDto)
{
var task = await GetNextTask(new GetNextTaskInDto()
{
@ -84,10 +85,26 @@ namespace IRaCIS.Application.Services
// 阅片期取前面所有的图像
visitIds.AddRange(await _subjectVisitRepository.Where(x => x.VisitNum <= task.VisitNum && x.SubjectId == task.SubjectId).Select(x => x.Id).ToListAsync());
}
List<NoneDicomStudyView> result = await _noneDicomStudyRepository.Where(t => visitIds.Contains(t.SubjectVisitId) && t.NoneDicomFileList.Any(t=>!t.FileType.Contains(StaticData.FileType.Zip)))
.ProjectTo<NoneDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = true }).ToListAsync();
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisistTaskId).FirstNotNullAsync();
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisistTaskId).Select(t => new { t.BlindSubjectCode, t.TrialReadingCriterionId, t.TrialReadingCriterion.IsImageFilter, t.TrialReadingCriterion.CriterionModalitys }).FirstNotNullAsync();
IQueryable<NoneDicomStudyView> noneDicomStudyQueryable = default;
if (inDto.VisistTaskId == null)
{
noneDicomStudyQueryable = _noneDicomStudyRepository
.Where(t => visitIds.Contains(t.SubjectVisitId) && t.NoneDicomFileList.Any(t => !t.FileType.Contains(StaticData.FileType.Zip)))
.WhereIf(taskinfo.IsImageFilter == true, t => taskinfo.CriterionModalitys.Contains(t.Modality))
.ProjectTo<NoneDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = true });
}
else
{
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.TaskNoneDicomFileList.Any(t => t.VisitTaskId == inDto.VisistTaskId))
.Where(t => visitIds.Contains(t.SubjectVisitId))
.ProjectTo<TaskDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = true, visiTaskId = inDto.VisistTaskId });
}
List<NoneDicomStudyView> result = await noneDicomStudyQueryable.ToListAsync();
var trialInfo = await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => new
{
@ -121,7 +138,7 @@ namespace IRaCIS.Application.Services
var taskInfo = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).FirstNotNullAsync();
return ResponseOutput.Ok (result, new
return ResponseOutput.Ok(result, new
{
VisitTaskId = task.VisitTaskId,
SubjectId = task.SubjectId,

View File

@ -186,8 +186,11 @@ namespace IRaCIS.Core.Application.Contracts
public class GetReadingVisitStudyListIndto
{
[NotDefault]
public Guid TrialId { get; set; }
[NotDefault]
public Guid SujectVisitId { get; set; }
[NotDefault]
public Guid VisitTaskId { get; set; }
}

View File

@ -37,7 +37,7 @@ namespace IRaCIS.Core.Application.Services
IRepository<ReadingQuestionCriterionTrial> _trialReadingCriterionRepository
) : BaseService, ISubjectVisitService
{
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
@ -541,7 +541,7 @@ namespace IRaCIS.Core.Application.Services
SeriesId = x.SeriesId,
StudyId = x.StudyId,
InstanceId = x.InstanceId,
NumberOfFrames=x.NumberOfFrames,
NumberOfFrames = x.NumberOfFrames,
}).ToListAsync();
@ -594,20 +594,20 @@ namespace IRaCIS.Core.Application.Services
HtmlPath = k.HtmlPath,
Path = k.Path,
InstanceNumber = k.InstanceNumber,
StudyId= k.StudyId,
SeriesId= k.SeriesId,
StudyId = k.StudyId,
SeriesId = k.SeriesId,
}).ToListAsync();
item.InstanceInfoList.ForEach(x =>
{
var keyFramesList = rowInfoList.Where(y => y.InstanceId == x.Id&&y.NumberOfFrames!=0).Select(y => y.NumberOfFrames).Distinct().ToList();
var keyFramesList = rowInfoList.Where(y => y.InstanceId == x.Id && y.NumberOfFrames != 0).Select(y => y.NumberOfFrames).Distinct().ToList();
if (keyFramesList.Count() > 0)
{
x.KeyFramesList = keyFramesList;
}
var item = rowInfoList.FirstOrDefault(y => y.InstanceId == x.Id);
if (item != null)
{
@ -632,7 +632,7 @@ namespace IRaCIS.Core.Application.Services
studyList.Insert(0,thisVisitTaskStudy);
studyList.Insert(0, thisVisitTaskStudy);
}
@ -658,7 +658,7 @@ namespace IRaCIS.Core.Application.Services
#region 非Dicom 检查查询
var noDicomList = await _noneDicomStudyRepository.Where(x => x.TrialId == indto.TrialId && x.SubjectVisitId == indto.SujectVisitId && x.NoneDicomFileList.Any(t => !t.FileType.Contains(StaticData.FileType.Zip)))
.WhereIf(taskInfo.IsImageFilter == true, t => taskInfo.CriterionModalitys.Contains(t.Modality) ).ToListAsync();
.WhereIf(taskInfo.IsImageFilter == true, t => taskInfo.CriterionModalitys.Contains(t.Modality)).ToListAsync();
List<VisitStudyDTO> noDicomStudyList = noDicomList.Select(x => new VisitStudyDTO()
@ -672,11 +672,14 @@ namespace IRaCIS.Core.Application.Services
}).ToList();
var isExistTaskNoneDicomFile = _noneDicomStudyFileRepository.Any(t => t.VisitTaskId == indto.VisitTaskId);
foreach (var item in noDicomStudyList)
{
var nodicom = noDicomList.Where(x => x.Id == item.StudyId).First();
var instanceCount = await _noneDicomStudyFileRepository.Where(x => x.NoneDicomStudyId == item.StudyId).CountAsync();
var instanceCount = await _noneDicomStudyFileRepository.WhereIf(isExistTaskNoneDicomFile,x=>x.OriginNoneDicomStudyId== item.StudyId)
.WhereIf(isExistTaskNoneDicomFile==false, x=>x.NoneDicomStudyId == item.StudyId).CountAsync();
if (instanceCount == 0)
{
@ -697,7 +700,9 @@ namespace IRaCIS.Core.Application.Services
SubjectVisitId=nodicom.SubjectVisitId,
SubjectId=nodicom.SubjectId,
SeriesNumber=1,
NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.Where(x=>x.NoneDicomStudyId==item.StudyId && !x.FileType.Contains(StaticData.FileType.Zip)).Select(x=>x.Path).FirstOrDefaultAsync(),
NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.WhereIf(isExistTaskNoneDicomFile,x=>x.OriginNoneDicomStudyId== item.StudyId)
.WhereIf(isExistTaskNoneDicomFile==false, x=>x.NoneDicomStudyId == item.StudyId)
.Where(x=> !x.FileType.Contains(StaticData.FileType.Zip)).Select(x=>x.Path).FirstOrDefaultAsync(),
}
};

View File

@ -33,7 +33,7 @@ namespace IRaCIS.Core.Domain.Models
public VisitTask VisitTask { get; set; }
[NotMapped]
public List<string> ScreenshotList => JsonConvert.DeserializeObject<List<string>>(ScreenshotListStr);
public List<string> FeedBackScreenshotList => JsonConvert.DeserializeObject<List<string>>(ScreenshotListStr);
#endregion

View File

@ -16,8 +16,6 @@ namespace IRaCIS.Core.Domain.Models
[JsonIgnore]
public TrialSite TrialSite { get; set; }
[JsonIgnore]
public VisitStage VisitStage { get; set; }
[JsonIgnore]
[ForeignKey("OutPlanPreviousVisitId")]
public SubjectVisit OutPlanPreviousVisit { get; set; }

View File

@ -16,8 +16,8 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
public void Configure(EntityTypeBuilder<Dictionary> builder)
{
builder.HasMany(t => t.ChildList).WithOne(t => t.Parent);
//自身同时存在一对多 和一对一的关系,配置一对多的就可以,一对一 不用配置,有点奇怪
builder.HasMany(t => t.ChildList).WithOne(t => t.Parent).HasForeignKey(d => d.ParentId);
}
}

View File

@ -1,33 +0,0 @@
using IRaCIS.Core.Domain.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.Reflection.Emit;
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
public class DoctorConfigration : IEntityTypeConfiguration<DoctorDictionary>
{
public void Configure(EntityTypeBuilder<DoctorDictionary> builder)
{
builder
.HasOne(dd => dd.Doctor)
.WithMany(p => p.DoctorDicRelationList)
.HasForeignKey(dd => dd.DoctorId);
builder
.HasOne(dd => dd.Dictionary)
.WithMany(d => d.DoctorDicRelationList)
.HasForeignKey(dd => dd.DictionaryId);
}
}
}

View File

@ -12,7 +12,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
public void Configure(EntityTypeBuilder<ReadModule> builder)
{
builder.HasOne(t => t.SubjectVisit).WithMany(t => t.ReadModuleList);
builder.HasOne(t => t.SubjectVisit).WithMany(t => t.ReadModuleList).HasForeignKey(t=>t.SubjectVisitId);
}
}
}

View File

@ -13,9 +13,9 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
//不能同时配置一对多 和一对一 但是有时表要存储多的最新的 比如受试者 最新的访视 在这里要显示配置
builder.HasOne(s => s.LatestSubjectVisit);
builder.HasOne(s => s.FinalSubjectVisit);
builder.HasMany(s => s.SubjectVisitList).WithOne(sv => sv.Subject);
builder.HasOne(s => s.LatestSubjectVisit).WithMany().HasForeignKey(t => t.LatestSubjectVisitId);
builder.HasOne(s => s.FinalSubjectVisit).WithMany().HasForeignKey(t => t.FinalSubjectVisitId);
builder.HasMany(s => s.SubjectVisitList).WithOne(sv => sv.Subject).HasForeignKey(t => t.SubjectId);
}
}
}

View File

@ -1,20 +0,0 @@
using IRaCIS.Core.Domain.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
public class SubjectVisitConfigration : IEntityTypeConfiguration<SubjectVisit>
{
public void Configure(EntityTypeBuilder<SubjectVisit> builder)
{
builder.HasOne(s => s.Subject).WithMany(sv => sv.SubjectVisitList);
}
}
}

View File

@ -1,38 +0,0 @@
using IRaCIS.Core.Domain.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
public class TrialDocUserTypeConfirmConfigration : IEntityTypeConfiguration<TrialDocNeedConfirmedUserType>
{
public void Configure(EntityTypeBuilder<TrialDocNeedConfirmedUserType> builder)
{
////项目文档 需要确认的用户类型 找到项目下对应用户类型的用户 用UserTypeId 关联
//builder
// .HasMany(dd => dd.TrialUserList)
// .WithOne(d => d.TrialDocNeedConfirmedUserType)
// .HasForeignKey(s => new {/* s.TrialId,*/ s.User.UserTypeId })
// .HasPrincipalKey(c => new { /*c.TrialDocument.TrialId,*/ c.NeedConfirmUserTypeId });
}
}
public class TrialDocConfirmUserConfigration : IEntityTypeConfiguration<TrialDocConfirmedUser>
{
public void Configure(EntityTypeBuilder<TrialDocConfirmedUser> builder)
{
//builder
// .HasOne(dd => dd.TrialUser)
// .WithMany(d => d.TrialDocUserConfirmedList)
// .HasForeignKey(s => new { s.TrialDocument.TrialId, s.ConfirmUserId })
// .HasPrincipalKey(c => new { c.TrialId, c.UserId });
}
}
}

View File

@ -5,16 +5,6 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
public class TrialSiteConfigration : IEntityTypeConfiguration<TrialSite>
{
public void Configure(EntityTypeBuilder<TrialSite> builder)
{
}
}
public class SubjectCriteriaEvaluationConfigration : IEntityTypeConfiguration<SubjectCriteriaEvaluation>
{

View File

@ -1,18 +0,0 @@
using IRaCIS.Core.Domain.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
public class TrialSiteSurveyConfigration : IEntityTypeConfiguration<TrialSiteSurvey>
{
public void Configure(EntityTypeBuilder<TrialSiteSurvey> builder)
{
}
}
}

View File

@ -0,0 +1,15 @@
#参考学习文档
https://www.cnblogs.com/cqpanda/p/16815263.html
# dotnet ef migrations add 签名名字 -p 项目名 -c 上下文名 -o 迁移文件生成目录
1、生成迁移文件
dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations
2、撤销刚才生成的迁移文件
dotnet ef migrations remove -p IRaCIS.Core.Test -c IRCContext
3、将迁移文件更新到数据库
dotnet ef database update -p IRaCIS.Core.Test -c IRCContext

View File

@ -0,0 +1,24 @@
using IRaCIS.Core.Domain.Models;
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<Dictionary>
{
public void Configure(EntityTypeBuilder<Dictionary> builder)
{
builder.HasMany(t => t.ChildList).WithOne(t => t.Parent).HasForeignKey(d => d.ParentId);
}
}
}

View File

@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
{
public class SubjectConfigration : IEntityTypeConfiguration<Subject>
{
public void Configure(EntityTypeBuilder<Subject> builder)
{
//不能同时配置一对多 和一对一 但是有时表要存储多的最新的 比如受试者 最新的访视 在这里要显示配置
builder.HasOne(s => s.LatestSubjectVisit);
builder.HasOne(s => s.FinalSubjectVisit);
builder.HasMany(s => s.SubejectVisitList).WithOne(sv => sv.Subject);
}
}
public class TestOneConfigration : IEntityTypeConfiguration<TestOne>
{
public void Configure(EntityTypeBuilder<TestOne> builder)
{
builder.HasOne(s => s.LatestTestMany).WithMany().HasForeignKey(t=>t.LatestTestManyId);
builder.HasOne(s => s.FinalTestMany).WithMany().HasForeignKey(t => t.FinalTestManyId);
builder.HasMany(s => s.TestManyList).WithOne(sv => sv.TestOne).HasForeignKey(t => t.TestOneId);
}
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
using Microsoft.EntityFrameworkCore;
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL;
public partial class IRCContext : DbContext
{
public IRCContext()
{
}
public IRCContext(DbContextOptions<IRCContext> options)
: base(options)
{
}
public virtual DbSet<TrialImageDownload> TrialImageDownload { get; set; }
public virtual DbSet<TestNew> TestNew { get; set; }
public virtual DbSet<Subject> Subject { get; set; }
public virtual DbSet<SubejectVisit> SubejectVisit { get; set; }
public virtual DbSet<Dictionary> Dictionary { get; set; }
public virtual DbSet<TestOne> TestOne { get; set; }
public virtual DbSet<TestMany> TestMany { get; set; }
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");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
//遍历实体模型手动配置
var typesToRegister = Assembly.GetExecutingAssembly().GetTypes().Where(q => q.GetInterface(typeof(IEntityTypeConfiguration<>).FullName) != null);
foreach (var type in typesToRegister)
{
dynamic configurationInstance = Activator.CreateInstance(type);
modelBuilder.ApplyConfiguration(configurationInstance);
}
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

View File

@ -0,0 +1,100 @@
// <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("20240910053652_testAdd")]
partial class testAdd
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TestName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TestNew");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DownloadEndTime")
.HasColumnType("datetime2");
b.Property<DateTime>("DownloadStartTime")
.HasColumnType("datetime2");
b.Property<int>("ImageCount")
.HasColumnType("int");
b.Property<long>("ImageSize")
.HasColumnType("bigint");
b.Property<int>("ImageType")
.HasColumnType("int");
b.Property<bool>("IsSuccess")
.HasColumnType("bit");
b.Property<Guid>("SubjectVisitId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TrialImageDownload");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,38 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
/// <inheritdoc />
public partial class testAdd : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TestNew",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TestName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, 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_TestNew", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TestNew");
}
}
}

View File

@ -0,0 +1,119 @@
// <auto-generated />
using System;
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
[DbContext(typeof(IRCContext))]
[Migration("20240910055957_navigateTest")]
partial class navigateTest
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TestName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid>("TrialImageDownloadId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TrialImageDownloadId");
b.ToTable("TestNew");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DownloadEndTime")
.HasColumnType("datetime2");
b.Property<DateTime>("DownloadStartTime")
.HasColumnType("datetime2");
b.Property<int>("ImageCount")
.HasColumnType("int");
b.Property<long>("ImageSize")
.HasColumnType("bigint");
b.Property<int>("ImageType")
.HasColumnType("int");
b.Property<bool>("IsSuccess")
.HasColumnType("bit");
b.Property<Guid>("SubjectVisitId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TrialImageDownload");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b =>
{
b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", null)
.WithMany("TestNewList")
.HasForeignKey("TrialImageDownloadId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
{
b.Navigation("TestNewList");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,51 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
/// <inheritdoc />
public partial class navigateTest : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "TrialImageDownloadId",
table: "TestNew",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.CreateIndex(
name: "IX_TestNew_TrialImageDownloadId",
table: "TestNew",
column: "TrialImageDownloadId");
migrationBuilder.AddForeignKey(
name: "FK_TestNew_TrialImageDownload_TrialImageDownloadId",
table: "TestNew",
column: "TrialImageDownloadId",
principalTable: "TrialImageDownload",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_TestNew_TrialImageDownload_TrialImageDownloadId",
table: "TestNew");
migrationBuilder.DropIndex(
name: "IX_TestNew_TrialImageDownloadId",
table: "TestNew");
migrationBuilder.DropColumn(
name: "TrialImageDownloadId",
table: "TestNew");
}
}
}

View File

@ -0,0 +1,213 @@
// <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("20240910073024_oneToManyAndOneToOne")]
partial class oneToManyAndOneToOne
{
/// <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.SubejectVisit", b =>
{
b.Property<Guid>("Id")
.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")
.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()
.HasColumnType("nvarchar(max)");
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")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TestName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid>("TrialImageDownloadId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TrialImageDownloadId");
b.ToTable("TestNew");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DownloadEndTime")
.HasColumnType("datetime2");
b.Property<DateTime>("DownloadStartTime")
.HasColumnType("datetime2");
b.Property<int>("ImageCount")
.HasColumnType("int");
b.Property<long>("ImageSize")
.HasColumnType("bigint");
b.Property<int>("ImageType")
.HasColumnType("int");
b.Property<bool>("IsSuccess")
.HasColumnType("bit");
b.Property<Guid>("SubjectVisitId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TrialImageDownload");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.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
}
}
}

View File

@ -0,0 +1,96 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
/// <inheritdoc />
public partial class oneToManyAndOneToOne : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SubejectVisit",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SubjectId = 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_SubejectVisit", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Subject",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
LatestSubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
FinalSubjectVisitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
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_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);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_SubejectVisit_Subject_SubjectId",
table: "SubejectVisit");
migrationBuilder.DropTable(
name: "Subject");
migrationBuilder.DropTable(
name: "SubejectVisit");
}
}
}

View File

@ -0,0 +1,269 @@
// <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("20240910075136_seftOneToManyAndOneToOne")]
partial class seftOneToManyAndOneToOne
{
/// <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")
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(max)");
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.SubejectVisit", b =>
{
b.Property<Guid>("Id")
.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")
.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()
.HasColumnType("nvarchar(max)");
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")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TestName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid>("TrialImageDownloadId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TrialImageDownloadId");
b.ToTable("TestNew");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DownloadEndTime")
.HasColumnType("datetime2");
b.Property<DateTime>("DownloadStartTime")
.HasColumnType("datetime2");
b.Property<int>("ImageCount")
.HasColumnType("int");
b.Property<long>("ImageSize")
.HasColumnType("bigint");
b.Property<int>("ImageType")
.HasColumnType("int");
b.Property<bool>("IsSuccess")
.HasColumnType("bit");
b.Property<Guid>("SubjectVisitId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TrialImageDownload");
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.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
}
}
}

View File

@ -0,0 +1,60 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
/// <inheritdoc />
public partial class seftOneToManyAndOneToOne : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Dictionary",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ConfigTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Code = table.Column<string>(type: "nvarchar(max)", 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_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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Dictionary");
}
}
}

View File

@ -0,0 +1,266 @@
// <auto-generated />
using System;
using IRaCIS.Core.Test.CodeFirstTest.MSSQL;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations
{
[DbContext(typeof(IRCContext))]
partial class IRCContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(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")
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(max)");
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", (string)null);
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.SubejectVisit", b =>
{
b.Property<Guid>("Id")
.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", (string)null);
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.Subject", b =>
{
b.Property<Guid>("Id")
.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()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("FinalSubjectVisitId");
b.HasIndex("LatestSubjectVisitId");
b.ToTable("Subject", (string)null);
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TestName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid>("TrialImageDownloadId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TrialImageDownloadId");
b.ToTable("TestNew", (string)null);
});
modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DownloadEndTime")
.HasColumnType("datetime2");
b.Property<DateTime>("DownloadStartTime")
.HasColumnType("datetime2");
b.Property<int>("ImageCount")
.HasColumnType("int");
b.Property<long>("ImageSize")
.HasColumnType("bigint");
b.Property<int>("ImageType")
.HasColumnType("int");
b.Property<bool>("IsSuccess")
.HasColumnType("bit");
b.Property<Guid>("SubjectVisitId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TrialImageDownload", (string)null);
});
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
}
}
}

View File

@ -0,0 +1,134 @@
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using System;
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
{
[Table("TrialImageDownload")]
public class TrialImageDownload : BaseFullAuditEntity
{
public Guid SubjectVisitId { get; set; }
public bool IsSuccess { get; set; }
public DateTime DownloadStartTime { get; set; }
public DateTime? DownloadEndTime { get; set; }
public ImageType ImageType { get; set; }
public int ImageCount { get; set; }
public long ImageSize { get; set; }
#region 测试导航属性
public List<TestNew> TestNewList { get; set; }
#endregion
}
public enum ImageType
{
Dicom = 1,
NoneDIcom = 2
};
public class TestNew : BaseFullAuditEntity
{
public Guid TrialImageDownloadId { get; set; }
[StringLength(100)]
public string TestName { get; set; }
}
public class Subject : BaseFullAuditEntity
{
public string Name { get; set; }
public Guid? LatestSubjectVisitId { get; set; }
public Guid? FinalSubjectVisitId { get; set; }
#region 同时配置一对多,一对一 导航属性
[ForeignKey("FinalSubjectVisitId")]
public SubejectVisit FinalSubjectVisit { get; set; }
[ForeignKey("LatestSubjectVisitId")]
public SubejectVisit LatestSubjectVisit { get; set; }
public List<SubejectVisit> SubejectVisitList { get; set; }
#endregion
}
public class SubejectVisit : BaseFullAuditEntity
{
public Subject Subject { get; set; }
public Guid SubjectId { get; set; }
}
public class Dictionary : BaseFullAuditEntity
{
#region 导航属性
[ForeignKey("ConfigTypeId")]
public Dictionary ConfigType { get; set; }
[ForeignKey("ParentId")]
public Dictionary Parent { get; set; }
public List<Dictionary> ChildList { get; set; } = new List<Dictionary>();
#endregion
public Guid? ParentId { get; set; }
public Guid? ConfigTypeId { get; set; }
public string Code { get; set; }
}
public class TestOne : BaseFullAuditEntity
{
public string Code { get; set; }
[ForeignKey(nameof(TestOne.FinalTestMany))]
public Guid? LatestTestManyId { get; set; }
[ForeignKey(nameof(TestOne.LatestTestMany))]
public Guid? FinalTestManyId { get; set; }
#region 同时配置一对多,一对一 导航属性
public TestMany FinalTestMany { get; set; }
public TestMany LatestTestMany { get; set; }
public List<TestMany> TestManyList { get; set; }
#endregion
}
public class TestMany : BaseFullAuditEntity
{
public TestOne TestOne { get; set; }
public Guid TestOneId { get; set; }
}
}

View File

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Net.Mime.MediaTypeNames;
partial class Program
{
@ -55,7 +56,15 @@ partial class Program
// 要生成的表名数组
var tableNames = new List<string>(args);
var tableNames = new List<string>(args);
var argsStr = args.ToString()??string.Empty;
if (argsStr.Contains(".") || argsStr.Contains("-")|| argsStr.Contains("application")|| argsStr.Contains("IR"))
{
tableNames = new List<string>();
}
try
{