| | | 1 | | namespace Elsa.Workflows.CommitStates; |
| | | 2 | | |
| | | 3 | | public class DefaultCommitStrategyRegistry : ICommitStrategyRegistry |
| | | 4 | | { |
| | 114 | 5 | | private readonly IDictionary<string, WorkflowCommitStrategyRegistration> _workflowStrategies = new Dictionary<string |
| | 114 | 6 | | private readonly IDictionary<string, ActivityCommitStrategyRegistration> _activityStrategies = new Dictionary<string |
| | | 7 | | |
| | | 8 | | |
| | | 9 | | public IEnumerable<WorkflowCommitStrategyRegistration> ListWorkflowStrategyRegistrations() |
| | | 10 | | { |
| | 0 | 11 | | return _workflowStrategies.Values; |
| | | 12 | | } |
| | | 13 | | |
| | | 14 | | public IEnumerable<ActivityCommitStrategyRegistration> ListActivityStrategyRegistrations() |
| | | 15 | | { |
| | 0 | 16 | | return _activityStrategies.Values; |
| | | 17 | | } |
| | | 18 | | |
| | | 19 | | public void RegisterStrategy(WorkflowCommitStrategyRegistration registration) |
| | | 20 | | { |
| | 5 | 21 | | _workflowStrategies[registration.Metadata.Name] = registration; |
| | 5 | 22 | | } |
| | | 23 | | |
| | | 24 | | public void RegisterStrategy(ActivityCommitStrategyRegistration registration) |
| | | 25 | | { |
| | 4 | 26 | | _activityStrategies[registration.Metadata.Name] = registration; |
| | 4 | 27 | | } |
| | | 28 | | |
| | | 29 | | public IWorkflowCommitStrategy? FindWorkflowStrategy(string name) |
| | | 30 | | { |
| | 0 | 31 | | return _workflowStrategies.TryGetValue(name, out var registration) ? registration.Strategy : null; |
| | | 32 | | } |
| | | 33 | | |
| | | 34 | | public IActivityCommitStrategy? FindActivityStrategy(string name) |
| | | 35 | | { |
| | 0 | 36 | | return _activityStrategies.TryGetValue(name, out var registration) ? registration.Strategy : null; |
| | | 37 | | } |
| | | 38 | | } |