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)
 {
     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 (sourcesDefintion.ByCustomPartitions)
         builder.SetByCustomPartitions();
     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);
     if (sourcesDefintion.Options.ReorderEvents)
         builder.SetReorderEvents(true);
     if (sourcesDefintion.Options.ProcessingLag != null)
         builder.SetProcessingLag(sourcesDefintion.Options.ProcessingLag.GetValueOrDefault());
     if (sourcesDefintion.Options.EmitStateUpdated)
         builder.SetEmitStateUpdated(true);
 }