예제 #1
0
        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();
            }
        }
예제 #2
0
 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();
     }
 }