44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using Svrnty.CQRS.Events.Abstractions;
|
|
using Svrnty.Sample.Events;
|
|
using Svrnty.CQRS.Events.Abstractions.Models;
|
|
|
|
namespace Svrnty.Sample.Workflows;
|
|
|
|
/// <summary>
|
|
/// Workflow for user lifecycle operations (add, remove, update).
|
|
/// Manages event emission for all user-related commands.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// <strong>Workflow Pattern:</strong>
|
|
/// This workflow represents the lifecycle of user entities in the system.
|
|
/// Each workflow instance corresponds to operations on a specific user or user-related process.
|
|
/// </para>
|
|
/// <para>
|
|
/// <strong>Events Emitted:</strong>
|
|
/// - <see cref="UserAddedEvent"/> when a user is added
|
|
/// - <see cref="UserRemovedEvent"/> when a user is removed
|
|
/// </para>
|
|
/// <para>
|
|
/// <strong>Phase 1 Behavior:</strong>
|
|
/// Currently, each command creates a new workflow instance with a unique ID.
|
|
/// Future phases will support workflow continuation for tracking user state over time.
|
|
/// </para>
|
|
/// </remarks>
|
|
public class UserWorkflow : Workflow
|
|
{
|
|
// No custom properties or methods needed for Phase 1
|
|
// Developers call the base Emit<TEvent>() method directly
|
|
// Or create helper methods for type safety:
|
|
|
|
/// <summary>
|
|
/// Emits a UserAddedEvent within this workflow.
|
|
/// </summary>
|
|
public void EmitAdded(UserAddedEvent @event) => Emit(@event);
|
|
|
|
/// <summary>
|
|
/// Emits a UserRemovedEvent within this workflow.
|
|
/// </summary>
|
|
public void EmitRemoved(UserRemovedEvent @event) => Emit(@event);
|
|
}
|