private static ArgumentMap CreateArgumentMap(JObject jObject, Action <JObject, ArgumentMap> populate)
        {
            var arg = new ArgumentMap();

            InitArgumentMap(jObject, populate, arg);

            return(arg);
        }
        private static void PopulatePersistArgumentMap(JToken jObject, ArgumentMap arg)
        {
            JToken members = jObject[JsonPropertyNames.Members];

            if (members != null)
            {
                PopulateArgumentMap(members, arg);
            }
            else
            {
                arg.Map = new Dictionary <string, IValue>();
            }
        }
        public static ArgumentMap CreateSimpleArgumentMap(string query)
        {
            NameValueCollection collection = HttpUtility.ParseQueryString(query);

            if (collection.AllKeys.Any() && collection.AllKeys.First() == null)
            {
                return(null);
            }

            var args = new ArgumentMap();

            PopulateReservedArgs(collection, args);
            PopulateSimpleArgumentMap(collection, args);
            return(args);
        }
        private static void PopulatePromptArgumentMap(JToken jObject, ArgumentMap arg)
        {
            JToken members           = jObject[JsonPropertyNames.PromptMembers];
            var    promptArgumentMap = arg as PromptArgumentMap;

            if (promptArgumentMap != null)
            {
                if (members != null)
                {
                    promptArgumentMap.MemberMap = GetNonReservedProperties(members).ToDictionary(jt => jt.Name, jt => GetValue((JObject)jt.Value, jt.Name));
                }
                else
                {
                    promptArgumentMap.MemberMap = new Dictionary <string, IValue>();
                }
            }
            arg.Map = GetNonReservedProperties(jObject).ToDictionary(jt => jt.Name, jt => GetValue((JObject)jt.Value, jt.Name));
        }
 private static void PopulateSimpleArgumentMap(NameValueCollection collection, ArgumentMap args)
 {
     args.Map = collection.AllKeys.Where(k => !IsReservedName(k)).ToDictionary(s => s, s => (IValue) new ScalarValue(collection[s]));
 }
 private static void PopulateArgumentMap(JToken jObject, ArgumentMap arg)
 {
     arg.Map = GetNonReservedProperties(jObject).ToDictionary(jt => jt.Name, jt => GetValue((JObject)jt.Value, jt.Name));
 }
        private static void InitArgumentMap(JObject jObject, Action <JObject, ArgumentMap> populate, ArgumentMap arg)
        {
            if (jObject != null)
            {
                try {
                    populate(jObject, arg);

                    arg.ValidateOnly          = GetValidateOnlyFlag(jObject);
                    arg.DomainModel           = GetDomainModelValue(jObject);
                    arg.SearchTerm            = GetSearchTerm(jObject);
                    arg.Page                  = GetPageValue(jObject);
                    arg.PageSize              = GetPageSizeValue(jObject);
                    arg.InlinePropertyDetails = GetInlinePropertyDetailsFlag(jObject);
                    arg.InlineCollectionItems = GetInlineCollectionItemsFlag(jObject);
                }
                catch (Exception e) {
                    Logger.ErrorFormat("Malformed argument map: {0}", e.Message);
                    arg.IsMalformed = true;
                }
            }
            else
            {
                arg.Map = new Dictionary <string, IValue>();
            }
        }
 private static void PopulateSimpleArgumentMap(NameValueCollection collection, ArgumentMap args) {
     args.Map = collection.AllKeys.Where(k => !IsReservedName(k)).ToDictionary(s => s, s => (IValue) new ScalarValue(collection[s]));
 }
        public static ArgumentMap CreateSimpleArgumentMap(string query) {
            NameValueCollection collection = HttpUtility.ParseQueryString(query);

            if (collection.AllKeys.Any() && collection.AllKeys.First() == null) {
                return null;
            }

            var args = new ArgumentMap();
            PopulateReservedArgs(collection, args);
            PopulateSimpleArgumentMap(collection, args);
            return args;
        }
        private static void PopulatePromptArgumentMap(JToken jObject, ArgumentMap arg) {
            JToken members = jObject[JsonPropertyNames.PromptMembers];
            var promptArgumentMap = arg as PromptArgumentMap;

            if (promptArgumentMap != null) {
                if (members != null) {
                    promptArgumentMap.MemberMap = GetNonReservedProperties(members).ToDictionary(jt => jt.Name, jt => GetValue((JObject) jt.Value, jt.Name));
                }
                else {
                    promptArgumentMap.MemberMap = new Dictionary<string, IValue>();
                }
            }
            arg.Map = GetNonReservedProperties(jObject).ToDictionary(jt => jt.Name, jt => GetValue((JObject) jt.Value, jt.Name));
        }
        private static void PopulatePersistArgumentMap(JToken jObject, ArgumentMap arg) {
            JToken members = jObject[JsonPropertyNames.Members];

            if (members != null) {
                PopulateArgumentMap(members, arg);
            }
            else {
                arg.Map = new Dictionary<string, IValue>();
            }
        }
 private static void PopulateArgumentMap(JToken jObject, ArgumentMap arg) {
     arg.Map = GetNonReservedProperties(jObject).ToDictionary(jt => jt.Name, jt => GetValue((JObject) jt.Value, jt.Name));
 }
        private static void InitArgumentMap(JObject jObject, Action<JObject, ArgumentMap> populate, ArgumentMap arg) {
            if (jObject != null) {
                try {
                    populate(jObject, arg);

                    arg.ValidateOnly = GetValidateOnlyFlag(jObject);
                    arg.DomainModel = GetDomainModelValue(jObject);
                    arg.SearchTerm = GetSearchTerm(jObject);
                    arg.Page = GetPageValue(jObject);
                    arg.PageSize = GetPageSizeValue(jObject);
                    arg.InlinePropertyDetails = GetInlinePropertyDetailsFlag(jObject);
                    arg.InlineCollectionItems = GetInlineCollectionItemsFlag(jObject);
                }
                catch (Exception e) {
                    Logger.ErrorFormat("Malformed argument map: {0}", e.Message);
                    arg.IsMalformed = true;
                }
            }
            else {
                arg.Map = new Dictionary<string, IValue>();
            }
        }
        private static ArgumentMap CreateArgumentMap(JObject jObject, Action<JObject, ArgumentMap> populate) {
            var arg = new ArgumentMap();

            InitArgumentMap(jObject, populate, arg);

            return arg;
        }