public void Handle(EventMessage @event) { var databaseBroadcasterFor = this.databaseBroadcaster.FirstOrDefault(_ => _.ForType == @event.Body.GetType()); if (databaseBroadcasterFor == null) return; var context = new FeatureBeeContext(); databaseBroadcasterFor.Broadcast(context, @event); context.SaveChanges(); }
public void Handle(EventMessage @event) { var context = new FeatureBeeContext(); var databaseBroadcasterFor = this.databaseBroadcaster.FirstOrDefault(_ => _.ForType == @event.Body.GetType()); if (databaseBroadcasterFor != null) { databaseBroadcasterFor.Broadcast(context, @event.Body); } else { Debug.WriteLine("No broadcaster found for event {0}", @event.GetType()); } context.SaveChanges(); }