Skip to content

Commit

Permalink
Merge pull request #15 from EasyAbp/allows-same-state-update
Browse files Browse the repository at this point in the history
Allows update without changing the state name
  • Loading branch information
gdlcf88 authored Jun 30, 2024
2 parents 04ff2c1 + 42a50c6 commit 0b53378
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>1.0.0-preview.2</Version>
<Version>1.0.0-preview.3</Version>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
<AbpProjectType>module</AbpProjectType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ public virtual Task<Process> CreateAsync(CreateProcessModel model, DateTime now)

public virtual Task UpdateStateAsync(Process process, IProcessState nextState)
{
var processDefinition = Options.GetProcessDefinition(process.ProcessName);
if (nextState.StateName != process.StateName)
{
var processDefinition = Options.GetProcessDefinition(process.ProcessName);

var nextStates = processDefinition.GetChildStateNames(process.StateName);
var nextStates = processDefinition.GetChildStateNames(process.StateName);

if (!nextStates.Contains(nextState.StateName))
{
throw new AbpException(
$"The specified state `{nextState.StateName}` is invalid for the process `{process.ProcessName}`");
if (!nextStates.Contains(nextState.StateName))
{
throw new AbpException(
$"The specified state `{nextState.StateName}` is invalid for the process `{process.ProcessName}`");
}
}

process.SetState(nextState);
Expand Down

0 comments on commit 0b53378

Please sign in to comment.