Пример #1
0
        private static async Task ImportProjectionsAsync(ProjectionsProjectNode project, IProjectionsManager projectionsManager, IList<ProjectionStatistics> projections)
        {
            foreach (var projection in projections)
            {
                var configResponse = await projectionsManager.GetConfigAsync(projection.Name);

                if (!configResponse.IsSuccessful)
                {
                    Output.Pane.OutputStringThreadSafe(
                        string.Format("Unable to fetch projection {0}, server returned {1}", projection.Name,
                                      configResponse.Status));
                    continue;
                }


                AddProjectionFileIntoProject(project, configResponse.Result, projection);
            }
        }
 private void LoadAndParseQuery(IProjectionsManager projectionManager, string projectionName, out List <string> streams, out List <Tuple <string, string> > types)
 {
     if (projectionManager.Exists(projectionName))
     {
         var query         = projectionManager.GetQuery(projectionName);
         var streamsString = streamsExpression.Match(query).Groups[1].Value;
         streams = streamsString
                   .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                   .Select(x => x.Trim(' ', '\''))
                   .ToList();
         var matches = typesExpression.Matches(query);
         types = matches.Cast <Match>().Select(m => Tuple.Create(m.Groups[1].Value, m.Groups[2].Value)).ToList();
     }
     else
     {
         streams = new List <string>();
         types   = new List <Tuple <string, string> >();
     }
 }
 private void CreateOrUpdateQuery(IProjectionsManager projectionManager, string projectionName, IList<string> streams, IList<Tuple<string, string>> types)
 {
     var newQuery = RenderQuery(streams, types);
     if (!projectionManager.Exists(projectionName))
     {
         if (newQuery != null)
         {
             projectionManager.CreateContinuous(projectionName, newQuery);                    
         }
     }
     else
     {
         if (newQuery != null)
         {
             projectionManager.UpdateQuery(projectionName, newQuery);
             //projectionManager.Enable(projectionName);
         }
         else
         {
             projectionManager.Delete(projectionName);
         }
     }
 }
        private void CreateOrUpdateQuery(IProjectionsManager projectionManager, string projectionName, IList <string> streams, IList <Tuple <string, string> > types)
        {
            var newQuery = RenderQuery(streams, types);

            if (!projectionManager.Exists(projectionName))
            {
                if (newQuery != null)
                {
                    projectionManager.CreateContinuous(projectionName, newQuery);
                }
            }
            else
            {
                if (newQuery != null)
                {
                    projectionManager.UpdateQuery(projectionName, newQuery);
                    //projectionManager.Enable(projectionName);
                }
                else
                {
                    projectionManager.Delete(projectionName);
                }
            }
        }
Пример #5
0
 public GetMembersQuery(IProjectionsManager projectionsManager)
 {
     _projectionsManager = projectionsManager;
 }
 private void LoadAndParseQuery(IProjectionsManager projectionManager, string projectionName, out List<string> streams, out List<Tuple<string, string>> types)
 {
     if (projectionManager.Exists(projectionName))
     {
         var query = projectionManager.GetQuery(projectionName);
         var streamsString = streamsExpression.Match(query).Groups[1].Value;
         streams = streamsString
             .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
             .Select(x => x.Trim(' ', '\''))
             .ToList();
         var matches = typesExpression.Matches(query);
         types = matches.Cast<Match>().Select(m => Tuple.Create(m.Groups[1].Value, m.Groups[2].Value)).ToList();
     }
     else
     {
         streams = new List<string>();
         types = new List<Tuple<string, string>>();
     }
 }
Пример #7
0
 public GetPostsQuery(IProjectionsManager projectionsManager)
 {
     _projectionsManager = projectionsManager;
 }