Question

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?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top