diff --git a/Library/DbSql/DBSync.cs b/Library/DbSql/DBSync.cs
index 5caa4a9..c8abbbc 100644
--- a/Library/DbSql/DBSync.cs
+++ b/Library/DbSql/DBSync.cs
@@ -114,7 +114,9 @@ namespace Serein.DbSql
{
// Console.WriteLine($"主数据库无法连接,IP:{IP},端口:{Port}");
DBSync.SetIsNeedSyncData(true); // 网络不可达
+
return null;
+
}
// 检查是否需要同步数据
@@ -134,7 +136,9 @@ namespace Serein.DbSql
catch // (Exception ex)
{
// Console.WriteLine($"发生异常:{ex.Message}");
+
return null;
+
}
}
@@ -168,8 +172,14 @@ namespace Serein.DbSql
}
public static string GetDescription(DBSyncExType value)
{
+
FieldInfo field = value.GetType().GetField(value.ToString());
+
+
+
DescriptionAttribute attribute = (DescriptionAttribute)field.GetCustomAttribute(typeof(DescriptionAttribute));
+
+
return attribute == null ? value.ToString() : attribute.Description;
}
@@ -184,15 +194,21 @@ namespace Serein.DbSql
///
/// 主数据库配置
///
+
private static ConnectionConfig PrimaryConfig { get; set; }
+
///
/// 从数据库配置
///
+
private static ConnectionConfig SecondaryConfig { get; set; }
+
///
/// 主数据库IP
///
+
private static string Host { get; set; }
+
///
/// 主数据库端口
///
@@ -200,8 +216,12 @@ namespace Serein.DbSql
///
/// 同步数据事件(远程数据库,本地数据库,是否执行成功)
///
+
private static Func SyncDataEvent { get; set; }
+
+
private static Action StateChangeEvent { get; set; }
+
///
/// 数据库设置锁
///
@@ -467,8 +487,14 @@ namespace Serein.DbSql
public static string GetDescription(DBSyncStart value)
{
+
FieldInfo field = value.GetType().GetField(value.ToString());
+
+
+
DescriptionAttribute attribute = (DescriptionAttribute)field.GetCustomAttribute(typeof(DescriptionAttribute));
+
+
return attribute == null ? value.ToString() : attribute.Description;
}
@@ -565,11 +591,15 @@ namespace Serein.DbSql
};
break;
default:
+
config = null;
+
break;
}
+
return config;
+
}
}
diff --git a/Library/DbSql/RepositoryBase.cs b/Library/DbSql/RepositoryBase.cs
index e98ba8f..0cd8253 100644
--- a/Library/DbSql/RepositoryBase.cs
+++ b/Library/DbSql/RepositoryBase.cs
@@ -398,7 +398,9 @@ namespace Serein.Helper
isHaveErr = true;
ErrMsg = ex.Message;
+
return null;
+
}
}
@@ -503,7 +505,9 @@ namespace Serein.Helper
}
+
public virtual string GetPageList(Pagination pagination, Expression> where = null)
+
{
//DatabaseSync.StartcaControls();
return new
@@ -523,7 +527,9 @@ namespace Serein.Helper
}
+
public virtual List GetTop(int Top, Expression> expression, OrderByType _OrderByType = OrderByType.Asc, Expression> where = null, string selstr = "*")
+
{
return SyncRead(db => db.Queryable().Select(selstr).WhereIF(where != null, where)
.Take(Top)
@@ -539,14 +545,18 @@ namespace Serein.Helper
///
///
///
+
public virtual TEntity GetFirst(Expression> OrderExpression, OrderByType _OrderByType = OrderByType.Asc, Expression> where = null)
+
{
return SyncRead(db => db.Queryable().Filter(filterName, isDisabledGobalFilter: true).WhereIF(where != null, where)
.OrderBy(OrderExpression, _OrderByType)
.First());
}
+
public virtual List GetList(Pagination pagination, Expression> where = null)
+
{
int totalNumber = 0;
List result = SyncRead(db => db.Queryable().WhereIF(where != null, where).OrderBy(pagination.sidx + " " + pagination.sord)
@@ -557,7 +567,9 @@ namespace Serein.Helper
}
+
public virtual List GetList(Expression> where = null)
+
{
return SyncRead(db => db.Queryable().WhereIF(where != null, where).Filter(filterName, isDisabledGobalFilter: true)
.ToList());
@@ -569,7 +581,11 @@ namespace Serein.Helper
}
+
+
public virtual DataTable GetDataTable(Expression> where = null, Pagination pagination = null)
+
+
{
if (pagination != null)
{
@@ -598,7 +614,9 @@ namespace Serein.Helper
return 0;
});
+
filterName = null;
+
}
@@ -818,13 +836,17 @@ namespace Serein.Helper
///
/// /排序列
///
+
public string sidx { get; set; }
+
///
/// 排序类型
///
+
public string sord { get; set; }
+
///
/// 总记录数
///
diff --git a/Library/DynamicFlow/DynamicContext.cs b/Library/DynamicFlow/DynamicContext.cs
index 82c9ffa..eee62b7 100644
--- a/Library/DynamicFlow/DynamicContext.cs
+++ b/Library/DynamicFlow/DynamicContext.cs
@@ -39,7 +39,9 @@ namespace Serein.DynamicFlow
///
/// 动态流程上下文
///
+
public class DynamicContext(IServiceContainer serviceContainer)
+
{
private readonly string contextGuid = "";//System.Guid.NewGuid().ToString();
diff --git a/Library/DynamicFlow/MethodDetails.cs b/Library/DynamicFlow/MethodDetails.cs
index bc0e99b..b766f19 100644
--- a/Library/DynamicFlow/MethodDetails.cs
+++ b/Library/DynamicFlow/MethodDetails.cs
@@ -34,19 +34,25 @@ namespace Serein.DynamicFlow
/// 方法需要的类型
///
public Type DataType { get; set; }
+
///
/// 方法入参参数名称
///
public string ParameterName { get; set; }
+
///
/// 入参值
///
+
public string DataValue { get; set; }
+
+
public string[] Items { get; set; }
+
public ExplicitData Clone() => new()
{
Index = Index,
@@ -64,7 +70,7 @@ namespace Serein.DynamicFlow
public class MethodDetails
{
- public MethodDetails CpoyNew()
+ public MethodDetails Clone()
{
return new MethodDetails
{
@@ -73,37 +79,45 @@ namespace Serein.DynamicFlow
MethodDelegate = MethodDelegate,
MethodDynamicType = MethodDynamicType,
MethodGuid = Guid.NewGuid().ToString(),
- MethodTips = MethodTips + " Cpoy",
- //ParameterTypes = ParameterTypes,
+ MethodTips = MethodTips ,
ReturnType = ReturnType,
MethodName = MethodName,
MethodLockName = MethodLockName,
- //ExplicitDataValues = ExplicitDataValues.Select(it => "").ToArray(),
+
ExplicitDatas = ExplicitDatas.Select(it => it.Clone()).ToArray(),
- //IsExplicits = IsExplicits,
};
}
///
/// 作用实例
///
+
public Type ActingInstanceType { get; set; }
+
///
/// 作用实例
///
+
public object ActingInstance { get; set; }
+
///
/// 方法GUID
///
+
public string MethodGuid { get; set; }
+
///
/// 方法名称
///
+
public string MethodName { get; set; }
+
///
/// 方法委托
///
+
public Delegate MethodDelegate { get; set; }
+
///
/// 节点类型
///
@@ -111,28 +125,36 @@ namespace Serein.DynamicFlow
///
/// 锁名称
///
+
public string MethodLockName { get; set; }
+
///
/// 方法说明
///
+
public string MethodTips { get; set; }
+
///
/// 参数内容
///
+
public ExplicitData[] ExplicitDatas { get; set; }
+
///
/// 出参类型
///
+
public Type ReturnType { get; set; }
+
public bool IsCanConnect(Type returnType)
{
if (ExplicitDatas.Length == 0)
diff --git a/Library/DynamicFlow/NodeFlowStarter.cs b/Library/DynamicFlow/NodeFlowStarter.cs
index bcad046..672e84c 100644
--- a/Library/DynamicFlow/NodeFlowStarter.cs
+++ b/Library/DynamicFlow/NodeFlowStarter.cs
@@ -4,7 +4,12 @@ using Serein.DynamicFlow.NodeModel;
using Serein.DynamicFlow.Tool;
using Serein.Web;
using SqlSugar;
+using System;
using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
namespace DynamicDemo.Node
{
@@ -14,13 +19,19 @@ namespace DynamicDemo.Node
}
+
public class NodeFlowStarter(IServiceContainer serviceContainer,List methodDetails)
+
{
private readonly IServiceContainer ServiceContainer = serviceContainer;
private readonly List methodDetails = methodDetails;
+
private Action ExitAction = null;
+
+
private DynamicContext context = null;
+
public NodeRunTcs MainCts;
///
@@ -28,6 +39,11 @@ namespace DynamicDemo.Node
///
///
///
+ //public async Task RunAsync1(List nodes)
+ //{
+ // await Task.Run(async ()=> await StartRunAsync(nodes));
+ //}
+
public async Task RunAsync(List nodes)
{
var startNode = nodes.FirstOrDefault(p => p.IsStart);
@@ -109,18 +125,24 @@ namespace DynamicDemo.Node
try
{
+
if (!DelegateCache.GlobalDicDelegates.TryGetValue(md.MethodName, out Delegate del))
{
return;
}
+
var func = md.ExplicitDatas.Length == 0 ? ((Func