Add State v2 guard and DI integration demos to State sample#14
Merged
Conversation
Extends the State sample to demonstrate v2 features: - Guard delegates on [Transition] with CanCancelDraft/CanCancelSubmitted static guard methods on the holder class - DI integration via generated RegisterDi + AddTransitionTable extension - GetAllowedTriggers output showing terminal state (Paid) - Cancelled state added to enum for richer edge coverage - DesignPatternsSampleKind changed from Core to DependencyInjection to pull in the DI extension and enable DesignPatterns_EnableDiIntegration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DesignPatterns.Samples.Stateto demonstrate State v2 features:[Transition] Guardproperty withCanCancelDraft/CanCancelSubmittedstatic guard methods on the holder classRegisterDimethod +AddTransitionTableextension, resolvingITransitionTable<OrderStatus, OrderTrigger>fromServiceProviderCancelledstate andCanceltrigger for richer edge coverageDesignPatternsSampleKindfromCoretoDependencyInjectionto pull in DI extension and enableDesignPatterns_EnableDiIntegrationSample output
Test plan
dotnet build DesignPatterns.Samples.State -c Release— 0 warnings, 0 errorsdotnet run --project DesignPatterns.Samples.State -c Release— output matches expected