private void consumeEventOnAggregate(RaisedEvent raisedEvent, AggregateInfo aggregateInfo, ConsumptionLog consumptionLog) { //If it's not tracked, then select it from the domain. if (aggregateInfo.Lifestate == AggregateLifestate.Untracked) selectAggregate(aggregateInfo); using (var scope = new TransactionScope()) { try { try { //If we haven't found it in the domain, then create it, otherwise consume the event. if (aggregateInfo.Lifestate == AggregateLifestate.Untracked) AggregateFactory.Create(aggregateInfo, raisedEvent.Event); else aggregateInfo.Instance.AsDynamic().Receive(raisedEvent); } catch (ApplicationException e) { if (e.Source == "ReflectionMagic") throw new MissingMethodException( aggregateInfo.Type.FullName, string.Format( "{0}({1})", aggregateInfo.Lifestate == AggregateLifestate.Untracked ? "_ctor" : "Receive", raisedEvent.GetType())); throw; } } catch (Exception e) { consumptionLog.RecordExceptionForConsumer(e); } consumptionLog.RecordConsumptionComplete(); Store.LogConsumption(raisedEvent, consumptionLog); scope.Complete(); } }