host.Start()启动后的host对象和从容器获取的IWorkflowHost对象不一样
Describe the bug host.Start()启动后的host对象和从容器获取的IWorkflowHost对象不一样,从容器获取的IWorkflowHost对象无法启动工作流,提示工作流未注册。
` //启动代码片段 var host = provider.GetService<IWorkflowHost>(); host.RegisterWorkflow<TestWorkflow, MyDataClass>(); host.Start();
CommonUtitl.workflowHost = host; //保存对象全局使用
`
string id = "TestWorkflow"; int version = 1; string workflowId = null; var def = _registry.GetDefinition(id, version); //结果:null var def2 = CommonUtitl.workflowHost.Registry.GetDefinition(id, version); //结果:有值 var tt = CommonUtitl.workflowHost == _workflowHost; //结果:不相等
To Reproduce
Expected behavior 从容器获取的IWorkflowHost对象和host.Start();后一样
Additional context Add any other context about the problem here.
You should not holding a singleton lifetime reference at CommonUtil, this violate the idea of IoC. The lifetime behavior should specified during class registry time.