支持多流程模板

This commit is contained in:
yubaolee 2016-09-28 17:21:59 +08:00
parent d730ab5bdb
commit 2bb6da86cf
3 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using OptimaJet.Workflow.Core.Cache;
using OptimaJet.Workflow.Core.Model;
namespace OpenAuth.Mvc.Models
{
/// <summary>
/// 流程定义的缓存
/// <para>李玉宝新增于2016-09-28 17:15:45</para>
/// </summary>
public sealed class DefaultParcedProcessCache : IParsedProcessCache
{
private Dictionary<Guid, ProcessDefinition> _cache;
public void Clear()
{
_cache.Clear();
}
public ProcessDefinition GetProcessDefinitionBySchemeId(Guid schemeId)
{
if (_cache == null)
return null;
if (_cache.ContainsKey(schemeId))
return _cache[schemeId];
return null;
}
public void AddProcessDefinition(Guid schemeId, ProcessDefinition processDefinition)
{
if (_cache == null)
{
_cache = new Dictionary<Guid, ProcessDefinition> {{schemeId, processDefinition}};
}
else
{
if (_cache.ContainsKey(schemeId))
_cache[schemeId] = processDefinition;
else
_cache.Add(schemeId, processDefinition);
}
}
}
}

View File

@ -31,7 +31,8 @@ namespace OpenAuth.Mvc.Models
new MSSQLProvider(connectionString),
new OptimaJet.Workflow.Core.Parser.XmlWorkflowParser(),
new MSSQLProvider(connectionString)
).WithDefaultCache();
);
builder.SetCache(new DefaultParcedProcessCache());
_runtime = new WorkflowRuntime(new Guid("{8D38DB8F-F3D5-4F26-A989-4FDD40F32D9D}"))
.WithBuilder(builder)

View File

@ -167,6 +167,7 @@
<Compile Include="Controllers\RoleManagerController.cs" />
<Compile Include="Controllers\StockManagerController.cs" />
<Compile Include="Controllers\UserManagerController.cs" />
<Compile Include="Models\DefaultParcedProcessCache.cs" />
<Compile Include="Models\JobjectModelBinder.cs" />
<Compile Include="Models\WorkflowActionProvider.cs" />
<Compile Include="Models\WorkflowInit.cs" />