I have a few questions about how to implement state pattern in the MVC, and actually save the state of the object in the database.
Object (background) has a reference to the interface State
The specific State object is set by the controller object by assigning a specific class implementing the interface of the State
I have a few states, but suppose we have two possible states:
- Active
- Inactive
Assign a status of Active to the object, but how to save the information about state of object in the database (EntityFramework 4), that when we get data from the database was known state of object? Make an Enumeration field of possible states to the Property, and save the current state, and when specific class that implements the state will need to set the state auoub this information?
My question concerns a Strategy pattern - How to save information about the selected strategy for a given object?