문제

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?

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top