Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the stateless framework.

But I do not fully understand the state concept.
For example:
C#
phoneCall.Configure(State.Ringing)
    .Permit(Trigger.HungUp, State.OffHook)
    .Permit(Trigger.CallConnected, State.Connected);


Does it mean the workflow is from Ringing=>OffHook=>Connected unconditionally?

What I have tried:

I read the article. It says A transition’s Trigger is scheduled when the transition’s source state’s Entry action is complete.

But in my code example, there is no OnEntry in the configuration.
Posted
Updated 11-Mar-16 19:01pm

Quote:
Does it mean the workflow is from Ringing=>OffHook=>Connected unconditionally?


No, not as I read it - it reads to me as if the state is ringing, you can go to OffHook OR Connected depending on the trigger/event
 
Share this answer
 
Comments
[no name] 13-Mar-16 14:50pm    
Does the order matter?
Say
A:
phoneCall.Configure(State.Ringing)
.Permit(Trigger.HungUp, State.OffHook)
.Permit(Trigger.CallConnected, State.Connected);

And
B:
phoneCall.Configure(State.Ringing)
.Permit(Trigger.CallConnected, State.Connected)
.Permit(Trigger.HungUp, State.OffHook);

Are A and B same?
Garth J Lancaster 14-Mar-16 7:04am    
I cant say for sure - without going through the Stateless library - its does say it allows "Hierarchical states" - but to me, what youve shown is the same state, with two legal transitions
The "Stateless" project is an interesting one, but, I think the choice of the name is confusing: of course it maintains internal state; and, the "state machine" concept is all about "state" !

The code you cite sets up a "rule" for a given "state:" "ringing."

It defines two possible "transitions" from "ringing."

The "Entry" action will refer to a dynamically created event handler that the class creates at run-time.

Keep in mind that the "Stateless" project does not use Microsoft's Windows WorkFlow Foundation; it also uses very complex, and advanced, progamming techniques.

You might get some benefit by studying WWF in terms of insight into general "state machine" principles: [^].
 
Share this answer
 
Comments
Garth J Lancaster 14-Mar-16 6:59am    
>>BW "The "Stateless" project is an interesting one, but, I think the choice of the name is confusing: of course it maintains internal state; and, the "state machine" concept is all about "state" !" LOL, yes Bill

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900