public void ConfigureSourceProcessingStrategy(QuerySourceProcessingStrategyBuilder builder) { CheckDisposed(); var sourcesDefintion = _query.GetSourcesDefintion(); if (sourcesDefintion == null) throw new InvalidOperationException("Invalid query. No source definition."); if (sourcesDefintion.AllStreams) builder.FromAll(); else { if (sourcesDefintion.Streams != null) foreach (var stream in sourcesDefintion.Streams) builder.FromStream(stream); if (sourcesDefintion.Categories != null) foreach (var category in sourcesDefintion.Categories) builder.FromCategory(category); } if (sourcesDefintion.AllEvents) builder.AllEvents(); else if (sourcesDefintion.Events != null) foreach (var @event in sourcesDefintion.Events) builder.IncludeEvent(@event); if (sourcesDefintion.ByStreams) builder.SetByStream(); if (!string.IsNullOrWhiteSpace(sourcesDefintion.Options.StateStreamName)) builder.SetStateStreamNameOption(sourcesDefintion.Options.StateStreamName); if (!string.IsNullOrWhiteSpace(sourcesDefintion.Options.ForceProjectionName)) builder.SetForceProjectionName(sourcesDefintion.Options.ForceProjectionName); if (sourcesDefintion.Options.UseEventIndexes) builder.SetUseEventIndexes(true); }
public void ConfigureSourceProcessingStrategy(QuerySourceProcessingStrategyBuilder builder) { if (_sourceDefintion.AllEvents) builder.AllEvents(); if (_sourceDefintion.AllStreams) builder.FromAll(); if (_sourceDefintion.Categories != null) foreach (var category in _sourceDefintion.Categories) builder.FromCategory(category); if (_sourceDefintion.Streams != null) foreach (var stream in _sourceDefintion.Streams) builder.FromStream(stream); if (_sourceDefintion.Events != null) foreach (var @event in _sourceDefintion.Events) builder.IncludeEvent(@event); if (_sourceDefintion.ByStream) builder.SetByStream(); //TODO: set false if options == null? if (_sourceDefintion.Options != null && !string.IsNullOrEmpty(_sourceDefintion.Options.StateStreamName)) builder.SetStateStreamNameOption(_sourceDefintion.Options.StateStreamName); if (_sourceDefintion.Options != null && !string.IsNullOrEmpty(_sourceDefintion.Options.ForceProjectionName)) builder.SetForceProjectionName(_sourceDefintion.Options.ForceProjectionName); if (_sourceDefintion.Options != null) builder.SetUseEventIndexes(_sourceDefintion.Options.UseEventIndexes); if (_sourceDefintion.Options != null) builder.SetReorderEvents(_sourceDefintion.Options.ReorderEvents); if (_sourceDefintion.Options != null) builder.SetProcessingLag(_sourceDefintion.Options.ProcessingLag); if (_sourceDefintion.Options != null) builder.SetEmitStateUpdated(_sourceDefintion.Options.EmitStateUpdated); }
public void ConfigureSourceProcessingStrategy(QuerySourceProcessingStrategyBuilder builder) { if (AllStreams) builder.FromAll(); else { if (Streams != null) foreach (var stream in Streams) builder.FromStream(stream); if (Categories != null) foreach (var category in Categories) builder.FromCategory(category); } if (AllEvents) builder.AllEvents(); else if (Events != null) foreach (var @event in Events) builder.IncludeEvent(@event); if (ByStreams) builder.SetByStream(); if (ByCustomPartitions) builder.SetByCustomPartitions(); if (Options != null) { if (Options.IncludeLinks) builder.SetIncludeLinks(); if (!String.IsNullOrWhiteSpace(Options.ResultStreamName)) builder.SetResultStreamNameOption(Options.ResultStreamName); if (!String.IsNullOrWhiteSpace(Options.PartitionResultStreamNamePattern)) builder.SetPartitionResultStreamNamePatternOption(Options.PartitionResultStreamNamePattern); if (!String.IsNullOrWhiteSpace(Options.ForceProjectionName)) builder.SetForceProjectionName(Options.ForceProjectionName); if (Options.ReorderEvents) builder.SetReorderEvents(true); if (Options.ProcessingLag != null) builder.SetProcessingLag(Options.ProcessingLag.GetValueOrDefault()); } if (DefinesStateTransform) builder.SetDefinesStateTransform(); }
public void ConfigureSourceProcessingStrategy(QuerySourceProcessingStrategyBuilder builder) { if (_sourceDefinition.AllEvents) builder.AllEvents(); if (_sourceDefinition.AllStreams) builder.FromAll(); if (_sourceDefinition.Categories != null) foreach (var category in _sourceDefinition.Categories) builder.FromCategory(category); if (_sourceDefinition.Streams != null) foreach (var stream in _sourceDefinition.Streams) builder.FromStream(stream); if (_sourceDefinition.Events != null) foreach (var @event in _sourceDefinition.Events) builder.IncludeEvent(@event); if (_sourceDefinition.ByStream) builder.SetByStream(); //TODO: set false if options == null? if (_sourceDefinition.Options != null && _sourceDefinition.Options.IncludeLinks) builder.SetIncludeLinks(_sourceDefinition.Options.IncludeLinks); if (_sourceDefinition.Options != null && !string.IsNullOrEmpty(_sourceDefinition.Options.ResultStreamName)) builder.SetResultStreamNameOption(_sourceDefinition.Options.ResultStreamName); if (_sourceDefinition.Options != null && !string.IsNullOrEmpty(_sourceDefinition.Options.PartitionResultStreamNamePattern)) builder.SetPartitionResultStreamNamePatternOption(_sourceDefinition.Options.PartitionResultStreamNamePattern); if (_sourceDefinition.Options != null && !string.IsNullOrEmpty(_sourceDefinition.Options.ForceProjectionName)) builder.SetForceProjectionName(_sourceDefinition.Options.ForceProjectionName); if (_sourceDefinition.Options != null) builder.SetReorderEvents(_sourceDefinition.Options.ReorderEvents); if (_sourceDefinition.Options != null) builder.SetProcessingLag(_sourceDefinition.Options.ProcessingLag); if (_sourceDefinition.DefinesStateTransform) builder.SetDefinesStateTransform(); }