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