public static ISessionState ToHandleConnectionState(IConnection aConnection) { IMCollection <ISessionState> states = new MCollection <ISessionState> { new SessionStateOpen(), new SessionStateClose() }; return(states.Filter(state => state.CanHandle(aConnection)).GetFirst()); }
public IPersistenceState ToHandle(IEntity anEntity) { IMCollection <IPersistenceState> states = new MCollection <IPersistenceState> { new PersistedState(), new NotPersistedState() }; return(states.Filter(state => state.CanHandle(anEntity)).GetFirst()); }