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);
        }