NXDO.WorkFlow 2.0.68.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package NXDO.WorkFlow --version 2.0.68.1                
NuGet\Install-Package NXDO.WorkFlow -Version 2.0.68.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NXDO.WorkFlow" Version="2.0.68.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NXDO.WorkFlow --version 2.0.68.1                
#r "nuget: NXDO.WorkFlow, 2.0.68.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NXDO.WorkFlow as a Cake Addin
#addin nuget:?package=NXDO.WorkFlow&version=2.0.68.1

// Install NXDO.WorkFlow as a Cake Tool
#tool nuget:?package=NXDO.WorkFlow&version=2.0.68.1                

关于 NXDO.WorkFlow

NXDO.WorkFlow 是一个基与 NetCore 的流程处理框架,能够快速搭建支持工作流的业务功能平台。

包版本

  • 例:2.5.68.1,其中2为大版本,5为次版本,68(或者6080)则表示为Net6.0与Net8.0支持,最后的1为修订
  • 当包在 Net6.0 下时,其引用文件为 NXDO.WorkFlow.N6.dll ,真实版本为 2.5.60.1, 文件后缀N6与版本第三为60均表示为Net6.0
  • 当包在 Net8.0 下时,其引用文件为 NXDO.WorkFlow.N8.dll ,真实版本为 2.5.80.1, 文件后缀N8与版本第三为80均表示为Net8.0

运维系统(TODO:朱雀系统-支持流程图)

用于系统运行与维护:朱雀系统

工作流配置

配置文件内容:(NXDO.WorkFlow.json)

{
    "workflow": {
        //工作流模板克隆使用的格式化器
        //默认格式化器,内部采用MS建议弃用的 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
        //需在最终可执行工程中配置,以便启用
        //<PropertyGroup>
        //  <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
        //</PropertyGroup>
        //可实现 NXDO.WorkFlow.IBinaryXFormatter 接口,替换默认格式化器
        "xformatter": "NXDO.WorkFlow.BinaryXFormatter, NXDO.WorkFlow", //内置格式化器为友元类型

        //true: 兼容 net framework 版本,提交的流程数据
        //false: 仅支持 netcore 提交的流程数据
        "compatible": true
    }
}

流程控制器

1.存储控制器

    public class WFStoreController : NXDO.WorkFlow.WebAPI.ApiFlowDbStoreContoller {
        protected override string GetNameOfUserEntity() {
            return "UserName"; //用户真实姓名
        }

        protected override Type GetTypeOfUserEntity() {
            return typeof(Test.AUser); //外部定义的用户实体类
        }

        protected override FlowCreateTable GetDbStoreCreateTable() {
            return new FlowMySQLTable(); //使用mysql数据库
        }

        //...其他代码
        //this.GetFlowDbStore(); 存储操作的对象实例
    }

2.执行控制器

    public class WFExecController : 
        NXDO.WorkFlow.WebAPI.ApiFlowEngineController {

            protected override bool GetAllowOneNodeExecute(long flowId) {
                //是否允许单个节点的流程执行,默认为 false。
                return true;
            }

            //...其他代码

            override void SynchronizedFlowSave(...) //处理外部数据的存储,不重写则什么也不做
            override void SendNotify(...) //发送通知,不重写则什么也不做
    }

3.注意 设置程序集引用,将 NXDO.WorkFlow.N6(8).dll 与 配置文件,复制到主程序运行目录即可 控制器的action参数基本使用 object 类型,可支持新增方法,实现 Flow 对象的传递。 基于 object 类型,支持 string, newton's JObject, netcore's JsonElement

需使用 Newtonsoft 时,注意修改 NXDO.WebAPI.json 的中配置

流程对象

var node1 = new Node("节点1", 10, 11, 12, 13);
var node2 = new Node("节点2", 20, 21, 22, 23);
var node3 = new Node("节点3", 30, 31, 32, 33);

var flow = new Flow();
flow.Id.Name = "netcore测试";

flow.AddNode(node1);
flow.AddNode(node2);
flow.AddNode(node3);
flow.AddUser(node1, new User(1));   //1为用户主键值
flow.AddUser(node2, new User(2));   //2为用户主键值
flow.AddUser(node3, new User(3) & new User(4));   //3,4为用户主键值

flowDbStore.Save(flow);

流程引擎

目前 ApiFlowEngineController 仅支持单个节点流程,如需处理子流程,请新建控制器进行处理

var fe = new NXDO.WorkFlow.Engine.FlowEngine(flow, user, isRejectGotoFirst);
var nes = fe.Execute();

foreach (var ne in nes){

    ...
    var hasChildren = ne.Node.HasChildFlow;
    var cflow = hasChildren ? ne.Node.FlowChildren[0] : null; 
    
    //(再次创建 FlowEngine 或者递归) 传入 cflow 子流程
    ...
}

NXDO.WorkFlow.FlowHelper.GetWattingSingleNode(...) //单个节点
NXDO.WorkFlow.FlowHelper.GetWattingNode(...); //多个节点列表
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.689 70 11/16/2024
2.0.68.1 80 11/13/2024
2.0.68 94 11/1/2024

1)flow的json格式化默认值支持,2)调整flow的保存功能,3)提供给朱雀用于管理的流程图设计功能