域名修改配置网址
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
c4f3b0d653
commit
7caabad651
|
@ -50,7 +50,7 @@
|
|||
"FromEmail": "uat@extimaging.com",
|
||||
"FromName": "UAT_IRC",
|
||||
"AuthorizationCode": "SHzyyl2021",
|
||||
"SiteUrl": "http://uat.extimaging.com/login"
|
||||
"SiteUrl": "http://irc.event.extimaging.com/login"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
"FromName": "Test_IRC",
|
||||
"AuthorizationCode": "SHzyyl2021",
|
||||
|
||||
"SiteUrl": "http://test.extimaging.com/login"
|
||||
"SiteUrl": "http://irc.test.extimaging.com/login"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
"FromEmail": "uat@extimaging.com",
|
||||
"FromName": "UAT_IRC",
|
||||
"AuthorizationCode": "SHzyyl2021",
|
||||
"SiteUrl": "http://uat.extimaging.com/login"
|
||||
"SiteUrl": "http://irc.uat.extimaging.com/login"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,12 +72,12 @@ namespace IRaCIS.Application.Services
|
|||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[UnitOfWork]
|
||||
public async Task<IResponseOutput> OldLocalImageResizeJpg([FromServices] IOSSService oSSService, [FromServices] IRepository _repository, [FromServices] IWebHostEnvironment _hostEnvironment)
|
||||
public async Task<IResponseOutput> OldLocalImageResizeJpg([FromServices] IOSSService oSSService, [FromServices] IRepository _repository, [FromServices] IWebHostEnvironment _hostEnvironment)
|
||||
{
|
||||
|
||||
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
|
||||
|
||||
var studyList = _repository.Where<DicomStudy>(t => t.SeriesList.Any(t=>t.ImageResizePath.Length < 10)).Select(t => new { t.TrialId, t.SiteId, t.SubjectId, t.SubjectVisitId, t.Id }).ToList();
|
||||
var studyList = _repository.Where<DicomStudy>(t => t.SeriesList.Any(t => t.ImageResizePath.Length < 10)).Select(t => new { t.TrialId, t.SiteId, t.SubjectId, t.SubjectVisitId, t.Id }).ToList();
|
||||
|
||||
foreach (var studyitem in studyList)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ namespace IRaCIS.Application.Services
|
|||
string fileName = summary.Key.Split('/').Last(); // 提取文件夹名
|
||||
return new
|
||||
{
|
||||
|
||||
|
||||
Key = summary.Key,
|
||||
InstanceId = Guid.TryParse(
|
||||
fileName.Split('.')[0],
|
||||
|
@ -116,11 +116,11 @@ namespace IRaCIS.Application.Services
|
|||
.Where(info => info.InstanceId != Guid.Empty)
|
||||
.ToList();
|
||||
|
||||
foreach ( var jpg in jpgInfoList)
|
||||
foreach (var jpg in jpgInfoList)
|
||||
{
|
||||
var seriesId= _repository.Where<DicomInstance>(t=>t.Id==jpg.InstanceId).Select(t=>t.SeriesId).FirstOrDefault();
|
||||
var seriesId = _repository.Where<DicomInstance>(t => t.Id == jpg.InstanceId).Select(t => t.SeriesId).FirstOrDefault();
|
||||
|
||||
await _repository.BatchUpdateAsync<DicomSeries>(t => t.Id == seriesId, t => new DicomSeries() { ImageResizePath ="/" +jpg.Key });
|
||||
await _repository.BatchUpdateAsync<DicomSeries>(t => t.Id == seriesId, t => new DicomSeries() { ImageResizePath = "/" + jpg.Key });
|
||||
}
|
||||
|
||||
// 设置 NextMarker 以获取下一页的数据
|
||||
|
@ -133,7 +133,7 @@ namespace IRaCIS.Application.Services
|
|||
Console.WriteLine($"Error: {ex.Message}");
|
||||
}
|
||||
|
||||
await _repository.SaveChangesAsync();
|
||||
await _repository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
@ -146,9 +146,11 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
|
||||
|
||||
var aa= _dicRepository._dbContext.Subject.Where(t => t.Id == Guid.Empty).ExecuteUpdate("FirstName","ddd");
|
||||
//var aa= _dicRepository._dbContext.Subject.Where(t => t.Id == Guid.Empty).ExecuteUpdate("FirstName","ddd");
|
||||
|
||||
await _repository.BatchUpdateAsync<Subject>(t => t.Id == Guid.Empty, u => new Subject() { FirstName = "fddd", LastName = "sss" });
|
||||
await _repository.BatchUpdateAsync<Subject>(t => t.Id == Guid.Empty, u => new Subject() { FirstName = "fddd", LastName = "sss", UpdateTime = DateTime.Now });
|
||||
|
||||
await _repository.Where<Subject>().ExecuteUpdateAsync(t => t.SetProperty(t => t.UpdateTime, u => DateTime.Now));
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
static MethodInfo UpdateAsyncMethodInfo =
|
||||
typeof(RelationalQueryableExtensions).GetMethod(nameof(RelationalQueryableExtensions.ExecuteUpdateAsync));
|
||||
|
||||
#region 避免使用
|
||||
|
||||
public static int ExecuteUpdate(this IQueryable query, string fieldName, object? fieldValue)
|
||||
{
|
||||
var updateBody = BuildUpdateBody(query.ElementType,
|
||||
|
@ -28,15 +30,53 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
return (int)UpdateMethodInfo.MakeGenericMethod(query.ElementType).Invoke(null, new object?[] { query, updateBody });
|
||||
}
|
||||
|
||||
|
||||
public static int ExecuteUpdate(this IQueryable query, IReadOnlyDictionary<string, object?> fieldValues)
|
||||
{
|
||||
var updateBody = BuildUpdateBody(query.ElementType, fieldValues);
|
||||
|
||||
return (int)UpdateMethodInfo.MakeGenericMethod(query.ElementType).Invoke(null, new object?[] { query, updateBody });
|
||||
}
|
||||
public static Task<int> ExecuteUpdateAsync(this IQueryable query, string fieldName, object? fieldValue, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var updateBody = BuildUpdateBody(query.ElementType,
|
||||
new Dictionary<string, object?> { { fieldName, fieldValue } });
|
||||
|
||||
return (Task<int>)UpdateAsyncMethodInfo.MakeGenericMethod(query.ElementType).Invoke(null, new object?[] { query, updateBody, cancellationToken })!;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Dictionary<string, object?> ExtractFieldValues<TSource>(this Expression<Func<TSource, TSource>> updateFactory)
|
||||
{
|
||||
var dic = new Dictionary<string, object?>();
|
||||
var obj = (TSource)Activator.CreateInstance(typeof(TSource));
|
||||
|
||||
Func<TSource, TSource> func = updateFactory.Compile();
|
||||
|
||||
TSource applyObj = func(obj);
|
||||
|
||||
var propList = ((MemberInitExpression)updateFactory.Body).Bindings.Select(mb => mb.Member.Name)
|
||||
.Select(propName => typeof(TSource).GetProperty(propName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)).ToList();
|
||||
|
||||
|
||||
foreach (PropertyInfo prop in propList)
|
||||
{
|
||||
object value = prop.GetValue(applyObj);
|
||||
dic.Add(prop.Name, value);
|
||||
}
|
||||
|
||||
return dic;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Task<int> ExecuteUpdateAsync(this IQueryable query, IReadOnlyDictionary<string, object?> fieldValues, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var updateBody = BuildUpdateBody(query.ElementType, fieldValues);
|
||||
|
||||
return (Task<int>)UpdateAsyncMethodInfo.MakeGenericMethod(query.ElementType).Invoke(null, new object?[] { query, updateBody, cancellationToken })!;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static LambdaExpression BuildUpdateBody(Type entityType, IReadOnlyDictionary<string, object?> fieldValues)
|
||||
{
|
||||
var setParam = Expression.Parameter(typeof(SetPropertyCalls<>).MakeGenericType(entityType), "s");
|
||||
|
|
|
@ -5,6 +5,7 @@ using IRaCIS.Core.Infrastructure;
|
|||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using SharpCompress.Factories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -170,7 +171,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
if (where == null) throw new ArgumentNullException(nameof(where));
|
||||
|
||||
|
||||
#region batch delete bug
|
||||
#region history 使用扩展删除包,同时自动赋值更新人 更新时间
|
||||
|
||||
var bindings = ((MemberInitExpression)updateFactory.Body).Bindings.ToList();
|
||||
|
||||
|
@ -205,62 +206,36 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
#endregion
|
||||
|
||||
|
||||
#region efcore 7
|
||||
|
||||
//Dictionary<string, object> propValues = new Dictionary<string, object>();
|
||||
|
||||
//// 获取表达式体的 MemberInitExpression
|
||||
//var memberInitExpr = (MemberInitExpression)updateFactory.Body;
|
||||
|
||||
|
||||
|
||||
//// 获取初始化的绑定信息
|
||||
//var bindings = memberInitExpr.Bindings.ToList();
|
||||
|
||||
//var hasPropNameList = bindings.Select(t => t.Member.Name).ToList();
|
||||
|
||||
|
||||
//// 遍历绑定信息
|
||||
//foreach (MemberAssignment binding in bindings)
|
||||
#region efcore 7 & 8
|
||||
//{
|
||||
// // 获取属性名
|
||||
// string propName = binding.Member.Name;
|
||||
// var fieldValues = updateFactory.ExtractFieldValues();
|
||||
|
||||
// // 获取属性值,需要对表达式进行编译和调用
|
||||
// var propValue = Expression.Lambda(binding.Expression).Compile().DynamicInvoke();
|
||||
// var hasPropNameList = ((MemberInitExpression)updateFactory.Body).Bindings.Select(t => t.Member.Name).ToList();
|
||||
|
||||
// // 现在,你可以访问属性名和属性值
|
||||
// propValues.Add(propName, propValue);
|
||||
//}
|
||||
|
||||
//if (typeof(IAuditUpdate).IsAssignableFrom(typeof(T)))
|
||||
//{
|
||||
|
||||
// if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateTime)))
|
||||
// if (typeof(IAuditUpdate).IsAssignableFrom(typeof(T)))
|
||||
// {
|
||||
// propValues.Add(nameof(IAuditUpdate.UpdateTime), DateTime.Now);
|
||||
|
||||
// if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateTime)))
|
||||
// {
|
||||
// fieldValues.Add(nameof(IAuditUpdate.UpdateTime), DateTime.Now);
|
||||
// }
|
||||
|
||||
// if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateUserId)))
|
||||
// {
|
||||
// fieldValues.Add(nameof(IAuditUpdate.UpdateUserId), updateUserId);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateUserId)))
|
||||
// {
|
||||
// propValues.Add(nameof(IAuditUpdate.UpdateUserId), updateUserId);
|
||||
|
||||
// }
|
||||
|
||||
// return await _dbContext.Set<T>().IgnoreQueryFilters().Where(where).ExecuteUpdateAsync(fieldValues).ConfigureAwait(false) > 0;
|
||||
//}
|
||||
|
||||
//return await _dbContext.Set<T>().IgnoreQueryFilters().Where(where).ExecuteUpdateAsync(s => s.SetProperty(t => "UpdateTime", u => "").se).ConfigureAwait(false) > 0;
|
||||
|
||||
////return await _dbContext.Set<T>().IgnoreQueryFilters().Where(where).ExecuteUpdateAsync(propValues.SetProperties<T>()).ConfigureAwait(false) > 0;
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue