public static void Create(ProjectionsManager manager, string[] commandArgs)
        {
            if (commandArgs.Length < 2)
            {
                Log("Invalid argument value (projection type)");
                return;
            }

            var type = commandArgs[0].Trim().ToLower();
            string pname;
            var query = GetQuery(commandArgs.Skip(1).ToArray(), out pname);

            if(query == null || (type != "onetime" && string.IsNullOrEmpty(pname)))
            {
                Log("Invalid arguments");
                return;
            }

            switch (type)
            {
                case "onetime":
                    Log("Creating onetime projection...");
                    manager.CreateOneTime(query);
                    Log("Created");
                    break;
                case "continuous":
                    Log("Creating continuous projection {0}...", pname);
                    manager.CreateContinuous(pname, query);
                    Log("Created");
                    break;
                default:
                    Log("projection type not recognized");
                    break;
            }
        }
Example #2
0
 Task IProjectionsManagement.CreateOneTimeAsync(string query)
 {
     Ensure.NotNullOrEmpty(query, "query");
     return(_projectionsManager.CreateOneTime(query));
 }