自动发布调整测试
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
7caabad651
commit
132f90b28e
|
@ -173,61 +173,58 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
#region history 使用扩展删除包,同时自动赋值更新人 更新时间
|
#region history 使用扩展删除包,同时自动赋值更新人 更新时间
|
||||||
|
|
||||||
var bindings = ((MemberInitExpression)updateFactory.Body).Bindings.ToList();
|
//var bindings = ((MemberInitExpression)updateFactory.Body).Bindings.ToList();
|
||||||
|
|
||||||
var hasPropNameList = bindings.Select(t => t.Member.Name).ToList();
|
//var hasPropNameList = bindings.Select(t => t.Member.Name).ToList();
|
||||||
|
|
||||||
|
|
||||||
if (typeof(IAuditUpdate).IsAssignableFrom(typeof(T)))
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateTime)))
|
|
||||||
{
|
|
||||||
bindings.Add(Expression.Bind(typeof(T).GetMember(nameof(IAuditUpdate.UpdateTime))[0], Expression.Constant(DateTime.Now)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateUserId)))
|
|
||||||
{
|
|
||||||
bindings.Add(Expression.Bind(typeof(T).GetMember(nameof(IAuditUpdate.UpdateUserId))[0], Expression.Constant(updateUserId)));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var member = Expression.MemberInit(Expression.New(typeof(T)), bindings);
|
|
||||||
|
|
||||||
var factory = Expression.Lambda<Func<T, T>>(member, Expression.Parameter(typeof(T), "x"));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return await _dbContext.Set<T>().IgnoreQueryFilters().Where(where).BatchUpdateAsync(factory).ConfigureAwait(false) > 0;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region efcore 7 & 8
|
|
||||||
//{
|
|
||||||
// var fieldValues = updateFactory.ExtractFieldValues();
|
|
||||||
|
|
||||||
// var hasPropNameList = ((MemberInitExpression)updateFactory.Body).Bindings.Select(t => t.Member.Name).ToList();
|
|
||||||
|
|
||||||
//if (typeof(IAuditUpdate).IsAssignableFrom(typeof(T)))
|
//if (typeof(IAuditUpdate).IsAssignableFrom(typeof(T)))
|
||||||
//{
|
//{
|
||||||
|
|
||||||
// if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateTime)))
|
// if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateTime)))
|
||||||
// {
|
// {
|
||||||
// fieldValues.Add(nameof(IAuditUpdate.UpdateTime), DateTime.Now);
|
// bindings.Add(Expression.Bind(typeof(T).GetMember(nameof(IAuditUpdate.UpdateTime))[0], Expression.Constant(DateTime.Now)));
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateUserId)))
|
// if (!hasPropNameList.Contains(nameof(IAuditUpdate.UpdateUserId)))
|
||||||
// {
|
// {
|
||||||
// fieldValues.Add(nameof(IAuditUpdate.UpdateUserId), updateUserId);
|
// bindings.Add(Expression.Bind(typeof(T).GetMember(nameof(IAuditUpdate.UpdateUserId))[0], Expression.Constant(updateUserId)));
|
||||||
|
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// return await _dbContext.Set<T>().IgnoreQueryFilters().Where(where).ExecuteUpdateAsync(fieldValues).ConfigureAwait(false) > 0;
|
//var member = Expression.MemberInit(Expression.New(typeof(T)), bindings);
|
||||||
//}
|
|
||||||
|
//var factory = Expression.Lambda<Func<T, T>>(member, Expression.Parameter(typeof(T), "x"));
|
||||||
|
|
||||||
|
//return await _dbContext.Set<T>().IgnoreQueryFilters().Where(where).BatchUpdateAsync(factory).ConfigureAwait(false) > 0;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region efcore 7 & 8
|
||||||
|
{
|
||||||
|
var fieldValues = updateFactory.ExtractFieldValues();
|
||||||
|
|
||||||
|
var hasPropNameList = ((MemberInitExpression)updateFactory.Body).Bindings.Select(t => t.Member.Name).ToList();
|
||||||
|
|
||||||
|
if (typeof(IAuditUpdate).IsAssignableFrom(typeof(T)))
|
||||||
|
{
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return await _dbContext.Set<T>().IgnoreQueryFilters().Where(where).ExecuteUpdateAsync(fieldValues).ConfigureAwait(false) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -80,7 +80,7 @@ trigger:
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: ssh
|
type: ssh
|
||||||
name: default
|
name: ssh-linux-test-irc-publish
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
os: Linux
|
os: Linux
|
||||||
|
@ -90,18 +90,17 @@ clone:
|
||||||
disable: true #禁用默认克隆
|
disable: true #禁用默认克隆
|
||||||
|
|
||||||
server:
|
server:
|
||||||
host: 101.132.193.237
|
host: 123.56.94.154
|
||||||
user: root
|
user: root
|
||||||
password:
|
password:
|
||||||
from_secret: uat_ssh_pwd
|
from_secret: test_ssh_pwd
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: greeting
|
- name: publish-test-irc
|
||||||
commands:
|
commands:
|
||||||
- echo start publish test-irc-api
|
- echo start publish test-irc-api
|
||||||
- cd /opt/hang/cicd/test_irc
|
- cd /opt/1panel/hang/devops/test-irc
|
||||||
- echo sh test-irc.sh v${DRONE_BUILD_NUMBER}
|
- sh test-irc.sh v${DRONE_BUILD_NUMBER}
|
||||||
- sh test-irc.sh
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
|
@ -112,28 +111,27 @@ trigger:
|
||||||
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: ssh
|
type: ssh
|
||||||
name: ssh-windows-test-study-publish
|
name: ssh-linux-test-study-publish
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
os: windows
|
os: Linux
|
||||||
arch: amd64
|
arch: 386
|
||||||
|
|
||||||
clone:
|
clone:
|
||||||
disable: true #禁用默认克隆
|
disable: true #禁用默认克隆
|
||||||
|
|
||||||
server:
|
server:
|
||||||
host: 123.56.94.154
|
host: 123.56.94.154
|
||||||
user: Administrator
|
user: root
|
||||||
password: WHxckj2019
|
password:
|
||||||
|
from_secret: test_ssh_pwd
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: publish-test-study
|
- name: publish-test-study
|
||||||
commands:
|
commands:
|
||||||
- Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait
|
- echo start publish test-study-api
|
||||||
- cd C:\CICD\Test.Study\netcore_repo
|
- cd /opt/1panel/hang/devops/test-study
|
||||||
- dotnet restore .\IRaCIS.Core.API\IRaCIS.Core.API.csproj --packages C:\Users\Administrator\.nuget\packages
|
- sh test-study.sh v${DRONE_BUILD_NUMBER}
|
||||||
- dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -c Release --no-restore --packages C:\Users\Administrator\.nuget\packages -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API
|
|
||||||
- Start-Service -Name "Test_Study_API"
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
|
|
Loading…
Reference in New Issue