Exemplo n.º 1
0
        internal IList <AsyncProjectionShard> BuildShards(DocumentStore store)
        {
            var projections = store
                              .Options
                              .Projections
                              .All;

            if (ProjectionFlag.IsEmpty())
            {
                return(projections
                       .Where(x => x.Lifecycle == ProjectionLifecycle.Async)
                       .SelectMany(x => x.AsyncProjectionShards(store))
                       .ToList());
            }

            if (ProjectionFlag.Contains(":"))
            {
                return(projections
                       .SelectMany(x => x.AsyncProjectionShards(store))
                       .Where(shard => shard.Name.Identity.EqualsIgnoreCase(ProjectionFlag))
                       .ToList());
            }

            var projectionSource = projections
                                   .FirstOrDefault(x => x.ProjectionName.EqualsIgnoreCase(ProjectionFlag));

            if (projectionSource == null)
            {
                return(new List <AsyncProjectionShard>());
            }

            return(projectionSource
                   .AsyncProjectionShards(store)
                   .ToList());
        }
Exemplo n.º 2
0
        public IList <ProjectionSource> SelectProjections(DocumentStore store)
        {
            var projections = store
                              .Options
                              .Projections
                              .All;

            if (ProjectionFlag.IsNotEmpty())
            {
                var list       = new List <ProjectionSource>();
                var projection = projections.FirstOrDefault(x => x.ProjectionName.EqualsIgnoreCase(ProjectionFlag));
                if (projection != null)
                {
                    list.Add(projection);
                }

                return(list);
            }

            return(projections);
        }
Exemplo n.º 3
0
        internal IList <IProjectionSource> SelectProjectionsForRebuild(DocumentStore store)
        {
            var projections = store
                              .Options
                              .Projections
                              .All
                              .Where(p => p.Lifecycle != ProjectionLifecycle.Live)
                              .ToList();

            if (ProjectionFlag.IsNotEmpty())
            {
                var list       = new List <IProjectionSource>();
                var projection = projections.FirstOrDefault(x => x.ProjectionName.EqualsIgnoreCase(ProjectionFlag));
                if (projection != null)
                {
                    list.Add(projection);
                }

                return(list);
            }

            return(projections);
        }