mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-19 07:44:59 +08:00
支持多流程模板
This commit is contained in:
parent
d730ab5bdb
commit
2bb6da86cf
45
OpenAuth.Mvc/Models/DefaultParcedProcessCache.cs
Normal file
45
OpenAuth.Mvc/Models/DefaultParcedProcessCache.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,8 @@ namespace OpenAuth.Mvc.Models
|
|||||||
new MSSQLProvider(connectionString),
|
new MSSQLProvider(connectionString),
|
||||||
new OptimaJet.Workflow.Core.Parser.XmlWorkflowParser(),
|
new OptimaJet.Workflow.Core.Parser.XmlWorkflowParser(),
|
||||||
new MSSQLProvider(connectionString)
|
new MSSQLProvider(connectionString)
|
||||||
).WithDefaultCache();
|
);
|
||||||
|
builder.SetCache(new DefaultParcedProcessCache());
|
||||||
|
|
||||||
_runtime = new WorkflowRuntime(new Guid("{8D38DB8F-F3D5-4F26-A989-4FDD40F32D9D}"))
|
_runtime = new WorkflowRuntime(new Guid("{8D38DB8F-F3D5-4F26-A989-4FDD40F32D9D}"))
|
||||||
.WithBuilder(builder)
|
.WithBuilder(builder)
|
||||||
|
@ -167,6 +167,7 @@
|
|||||||
<Compile Include="Controllers\RoleManagerController.cs" />
|
<Compile Include="Controllers\RoleManagerController.cs" />
|
||||||
<Compile Include="Controllers\StockManagerController.cs" />
|
<Compile Include="Controllers\StockManagerController.cs" />
|
||||||
<Compile Include="Controllers\UserManagerController.cs" />
|
<Compile Include="Controllers\UserManagerController.cs" />
|
||||||
|
<Compile Include="Models\DefaultParcedProcessCache.cs" />
|
||||||
<Compile Include="Models\JobjectModelBinder.cs" />
|
<Compile Include="Models\JobjectModelBinder.cs" />
|
||||||
<Compile Include="Models\WorkflowActionProvider.cs" />
|
<Compile Include="Models\WorkflowActionProvider.cs" />
|
||||||
<Compile Include="Models\WorkflowInit.cs" />
|
<Compile Include="Models\WorkflowInit.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user