diff --git a/README.md b/README.md index faa7e45..39ad47f 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,14 @@ public class MyDto ### Initialize the State Machine ```csharp -// Add transitions to the state machine -sm.AddTransition(MyStates.Initial, MyEvents.SomethingHappened, MyStates.SomeState, SomeMethodToExecuteAsync); -sm.AddTransition(MyStates.SomeState, MyEvents.SomethingElseHappened, MyStates.Complete, SomeOtherMethodToExecuteAsync); +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; + +// Create a logger (use NullLogger if you don't need logging) +ILogger> logger = new NullLogger>(); +// Initialize the state machine with the initial state +var sm = new StateMachine(MyStates.Initial, logger); ``` ### Define the Transitions @@ -75,19 +79,8 @@ With the simplified AddTransition method, you can now add transitions directly w ```csharp // Add transitions to the state machine -sm.AddTransition(new Transition( - currentState: MyStates.Initial, - evt: MyEvents.SomethingHappened, - nextState: MyStates.SomeState, - action: SomeMethodToExecuteAsync -)); - -sm.AddTransition(new Transition( - currentState: MyStates.SomeState, - evt: MyEvents.SomethingElseHappened, - nextState: MyStates.Complete, - action: SomeOtherMethodToExecuteAsync -)); +sm.AddTransition(MyStates.Initial, MyEvents.SomethingHappened, MyStates.SomeState, SomeMethodToExecuteAsync); +sm.AddTransition(MyStates.SomeState, MyEvents.SomethingElseHappened, MyStates.Complete, SomeOtherMethodToExecuteAsync); ``` ### Define the Action Methods