I’ve started to look through WF and can’t catch how it can replace my Domain object functionality.
Here is simple Domain object scenario:
class Order {
public int Id {get;}
public OrderStatus Status {get;private set;}
public void Approve () {
if (Status >= OrderStatus.Approved)
throw new InvalidOperationException("It is impossible to approve as order
Status:" + Status);
privateMethodCall();
Status = Status.Approved;
}
public void Complete () {
if (Status >= OrderStatus.Completed)
throw new InvalidOperationException("It is impossible to Complete as order
Status:" + Status);
privateMethodCall1();
Status = Status.Completed;
}
}
I’ve read that WF can do it better as Approve and Complete code will be placed in one place
and it won’t be possible to call them in wrong order. Is it true? and if it is true can you show me how it will look in WF using object model (not xaml).
Thanks in advance.
There are 2 ways that you can use workflow:
But, if you allready have code that works, I would not change it, you just add an extra layer of complexity without getting any business value.