InMemorySagaPersister causes InvalidCast exception
In issue #77 a bug was fixed in the in-memory saga persister lookup by property to verify that the looked up value can actually be cast over to the required type.
I believe a related fix needs to be made to the lookup by sagaId GUID as well. In the app I’m working on I’ve got two sagas, both of which use timeouts. When the timeout message arrives it uses the GUID based version of the Get function, which just blindly casts the found saga data over to T. Looking at the code both in the 2.5 branch and the develop branch, this issue appears to exist in both places.
Changing the lookup to something along the lines of this should fix the problem:
T ISagaPersister.Get<T>(Guid sagaId)
{
ISagaEntity result;
data.TryGetValue(sagaId, out result);
if (result != null && result is T)
return (T)result;
return default(T);
}
closed by commit 7fb72940932ef29cf6083b11d98da876f2f4f7b6