public Frame DeterminePersistenceFrame(IContainer container, HandlerChain chain, MethodCall sagaHandler, SagaStateExistence existence, ref Variable sagaId, Type sagaStateType, Variable existingState, out Variable loadedState) { var frame = new TransactionalFrame(); if (existence == SagaStateExistence.Existing) { var doc = frame.LoadDocument(sagaStateType, sagaId); loadedState = doc; } else { var mapping = new DocumentMapping(sagaStateType, new StoreOptions()); sagaId = new Variable(mapping.IdMember.GetMemberType(), existingState.Usage + "." + mapping.IdMember.Name); loadedState = existingState; } return(frame); }
protected override Frame buildPersistenceFrame(IContainer container, HandlerChain chain, SagaStateExistence existence, ref Variable sagaId, Type sagaStateType, Variable existingState, ref Variable loadedState) { var dbContextType = DetermineDbContextType(chain, container); var frame = new TransactionalFrame(dbContextType); if (existence == SagaStateExistence.Existing) { var doc = frame.LoadDocument(sagaStateType, sagaId); loadedState = doc; } else { var property = findIdProperty(sagaStateType); sagaId = new Variable(property.PropertyType, existingState.Usage + "." + property.Name); frame.InsertEntity(existingState); loadedState = existingState; } return(frame); }
public InMemorySagaPersistenceFrame(Type documentType, Variable sagaId, SagaStateExistence existence) { _sagaId = sagaId; _existence = existence; Document = new Variable(documentType, this); Persistor = new Variable(typeof(InMemoryEnvelopeTransaction), this); }
public void determine_saga_existence_from_handler_call(string methodName, SagaStateExistence existence) { var method = typeof(FooSaga).GetMethod(methodName); var @call = new HandlerCall(typeof(FooSaga), method); SagaFramePolicy.DetermineExistence(@call) .ShouldBe(existence); }
protected override Frame buildPersistenceFrame(SagaStateExistence existence, Variable sagaId, Type sagaStateType, ref Variable loadedState) { var frame = new InMemorySagaPersistenceFrame(sagaStateType, sagaId, existence); if (existence == SagaStateExistence.Existing) { loadedState = frame.Document; } return(frame); }
public Frame DeterminePersistenceFrame(MethodCall sagaHandler, SagaStateExistence existence, ref Variable sagaId, Type sagaStateType, Variable existingState, out Variable loadedState) { loadedState = existingState; if (existence == SagaStateExistence.New) { var prop = findIdProperty(sagaStateType); sagaId = new Variable(prop.PropertyType, existingState.Usage + "." + prop.Name); } var frame = buildPersistenceFrame(existence, sagaId, sagaStateType, ref loadedState); return(frame); }
public Frame DeterminePersistenceFrame(SagaStateExistence existence, ref Variable sagaId, Type sagaStateType, Variable existingState, out Variable loadedState) { loadedState = existingState; if (existence == SagaStateExistence.New) { var prop = FindIdProperty(sagaStateType); sagaId = new Variable(prop.PropertyType, existingState.Usage + "." + prop.Name); } var frame = new InMemorySagaPersistenceFrame(sagaStateType, sagaId, existence); if (existence == SagaStateExistence.Existing) { loadedState = frame.Document; } return(frame); }
protected override Frame buildPersistenceFrame(SagaStateExistence existence, Variable sagaId, Type sagaStateType, ref Variable loadedState) { throw new NotImplementedException(); }
protected abstract Frame buildPersistenceFrame(SagaStateExistence existence, Variable sagaId, Type sagaStateType, ref Variable loadedState);
protected abstract Frame buildPersistenceFrame(IContainer container, HandlerChain chain, SagaStateExistence existence, ref Variable sagaId, Type sagaStateType, Variable existingState, ref Variable loadedState);