public void UsingDefinition <T>() where T : SingleStreamAggregation <MyAggregate>, new() { _projection = new T(); var rules = theStore.Options.CreateGenerationRules(); rules.TypeLoadMode = TypeLoadMode.Dynamic; _projection.Compile(theStore.Options, rules); }
public void UsingDefinition(Action <SingleStreamAggregation <MyAggregate> > configure) { _projection = new SingleStreamAggregation <MyAggregate>(); configure(_projection); var rules = theStore.Options.CreateGenerationRules(); rules.TypeLoadMode = TypeLoadMode.Dynamic; _projection.Compile(theStore.Options, rules); }
/// <summary> /// Use a "self-aggregating" aggregate of type. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="lifecycle">Override the aggregate lifecycle. The default is Inline</param> /// <returns>The extended storage configuration for document T</returns> public MartenRegistry.DocumentMappingExpression <T> SelfAggregate <T>(ProjectionLifecycle?lifecycle = null) { // Make sure there's a DocumentMapping for the aggregate var expression = _options.Schema.For <T>(); var source = new SingleStreamAggregation <T>() { Lifecycle = lifecycle ?? ProjectionLifecycle.Inline }; source.AssembleAndAssertValidity(); All.Add(source); return(expression); }
public void adding_filter_for_another_aggregate_type() { var projection = new SingleStreamAggregation <MyAggregate>(); projection.ProjectEvent <AEvent>(a => { }); projection.FilterIncomingEventsOnStreamType(typeof(OtherAggregate)); projection.AssembleAndAssertValidity(); using var store = DocumentStore.For(ConnectionSource.ConnectionString); var filters = projection.BuildFilters(store); var filter = filters.OfType <AggregateTypeFilter>().Single(); filter.AggregateType.ShouldBe(typeof(OtherAggregate)); }
public void try_existing_QuestParty() { var aggregator = new SingleStreamAggregation <QuestParty>().Build(new StoreOptions()); aggregator.ShouldNotBeNull(); }