I have a property of a class that is mapped to another class that can't be stored in the database and can't be serialized; it implements the state pattern. So I have something like this:
public IState MyState { get; set; }
Where I have two different states
public class LockedState : IState ...
public class UnlockedState : IState ...
In the database I need to persist the name of the current state that can be accomplished using, for example:
string name = myState.GetType().Name;
Do I have to write a custom and verbose IUserState or is there anything around?
In order to do that I had to implement a custom IUserType in the following way: