Browse Source
Merge pull request #255 from colinin/4.3
provides extensions for overwriting RulesEngine
pull/274/head
cKey
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
15 additions and
7 deletions
-
aspnet-core/LINGYUN.MicroService.Common.sln
-
aspnet-core/modules/rules/LINGYUN.Abp.Rules.RulesEngine/LINGYUN/Abp/Rules/RulesEngine/RulesEngineContributor.cs
|
|
@ -152,7 +152,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Rules.RulesEngi |
|
|
EndProject |
|
|
EndProject |
|
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Rules.RulesEngine.Tests", "tests\LINGYUN.Abp.Rules.RulesEngine.Tests\LINGYUN.Abp.Rules.RulesEngine.Tests.csproj", "{CF253F0A-3A45-40EE-875F-0E57C8968C48}" |
|
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Rules.RulesEngine.Tests", "tests\LINGYUN.Abp.Rules.RulesEngine.Tests\LINGYUN.Abp.Rules.RulesEngine.Tests.csproj", "{CF253F0A-3A45-40EE-875F-0E57C8968C48}" |
|
|
EndProject |
|
|
EndProject |
|
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Rules.NRules.Tests", "tests\LINGYUN.Abp.Rules.NRules.Tests\LINGYUN.Abp.Rules.NRules.Tests.csproj", "{EF03A0A7-A93E-4DEF-A33E-F5A82E995FBF}" |
|
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Rules.NRules.Tests", "tests\LINGYUN.Abp.Rules.NRules.Tests\LINGYUN.Abp.Rules.NRules.Tests.csproj", "{EF03A0A7-A93E-4DEF-A33E-F5A82E995FBF}" |
|
|
EndProject |
|
|
EndProject |
|
|
Global |
|
|
Global |
|
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|
|
|
|
|
@ -31,12 +31,7 @@ namespace LINGYUN.Abp.Rules.RulesEngine |
|
|
|
|
|
|
|
|
public override void Initialize(RulesInitializationContext context) |
|
|
public override void Initialize(RulesInitializationContext context) |
|
|
{ |
|
|
{ |
|
|
var reSetting = new ReSettings |
|
|
_ruleEngine = CreateRulesEngine(); |
|
|
{ |
|
|
|
|
|
NestedRuleExecutionMode = NestedRuleExecutionMode.Performance |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
_ruleEngine = new Engine(Logger, reSetting); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var contributor in _workflowRulesContributors) |
|
|
foreach (var contributor in _workflowRulesContributors) |
|
|
{ |
|
|
{ |
|
|
@ -66,6 +61,19 @@ namespace LINGYUN.Abp.Rules.RulesEngine |
|
|
contributor.Shutdown(); |
|
|
contributor.Shutdown(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 重写自行构建规则引擎
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
protected virtual Engine CreateRulesEngine() |
|
|
|
|
|
{ |
|
|
|
|
|
var reSetting = new ReSettings |
|
|
|
|
|
{ |
|
|
|
|
|
NestedRuleExecutionMode = NestedRuleExecutionMode.Performance |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return new Engine(Logger, reSetting); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
protected virtual async Task ExecuteRulesAsync<T>(T input, WorkflowRules[] workflowRules, object[] @params = null) |
|
|
protected virtual async Task ExecuteRulesAsync<T>(T input, WorkflowRules[] workflowRules, object[] @params = null) |
|
|
{ |
|
|
{ |
|
|
|