예제 #1
0
        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);
            }
        }
예제 #2
0
        private QuerySourcesDefinition GetQuerySourcesDefinition()
        {
            CheckDisposed();
            var sourcesDefinition = _query.GetSourcesDefintion();

            if (sourcesDefinition == null)
            {
                throw new InvalidOperationException("Invalid query.  No source definition.");
            }
            return(sourcesDefinition);
        }
예제 #3
0
        public void ConfigureSourceProcessingStrategy(QuerySourceProcessingStrategyBuilder builder)
        {
            CheckDisposed();
            var sourcesDefinition = _query.GetSourcesDefintion();

            if (sourcesDefinition == null)
            {
                throw new InvalidOperationException("Invalid query.  No source definition.");
            }
            sourcesDefinition.ConfigureSourceProcessingStrategy(builder);
        }
예제 #4
0
        public void ConfigureSourceProcessingStrategy(QuerySourceProcessingStrategyBuilder builder)
        {
            var sourcesDefintion = _query.GetSourcesDefintion();

            if (sourcesDefintion == null)
            {
                throw new InvalidOperationException("Invalid query.  No source defintion.");
            }
            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();
            }
        }