public EventGraph(StoreOptions options) { Options = options; _aggregatorLookup = new AggregatorLookup(); _events.OnMissing = eventType => { var mapping = typeof(EventMapping <>).CloseAndBuildAs <EventMapping>(this, eventType); Options.Storage.AddMapping(mapping); return(mapping); }; _byEventName.OnMissing = name => { return(AllEvents().FirstOrDefault(x => x.EventTypeName == name)); }; InlineProjections = new ProjectionCollection(options); AsyncProjections = new ProjectionCollection(options); }
public EventGraph(StoreOptions options) { Options = options; _aggregatorLookup = new AggregatorLookup(); _events.OnMissing = eventType => { var mapping = typeof(EventMapping <>).CloseAndBuildAs <EventMapping>(this, eventType); Options.Storage.AddMapping(mapping); return(mapping); }; _byEventName.OnMissing = name => { return(AllEvents().FirstOrDefault(x => x.EventTypeName == name)); }; InlineProjections = new ProjectionCollection(options); AsyncProjections = new ProjectionCollection(options); // TODO -- this will change when we switch all the way over to the new V4 model _inlineProjections = new Lazy <IInlineProjection[]>(() => InlineProjections.Select(x => new TemporaryV4InlineShim(x)).OfType <IInlineProjection>().ToArray()); _establishTombstone = new Lazy <EstablishTombstoneStream>(() => new EstablishTombstoneStream(this)); }
/// <summary> /// Set default strategy to lookup IAggregator when no explicit IAggregator registration exists. /// </summary> /// <remarks>Unless called, <see cref="AggregatorLookup"/> is used</remarks> public void UseAggregatorLookup(IAggregatorLookup aggregatorLookup) { _aggregatorLookup = aggregatorLookup; }