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

            if (jObject != null)
            {
                try {
                    populate(jObject, arg);

                    arg.ValidateOnly = GetValidateOnlyFlag(jObject);
                    arg.DomainModel  = GetDomainModelValue(jObject);
                    arg.SearchTerm   = GetSearchTerm(jObject);
                }
                catch (Exception e) {
                    Logger.ErrorFormat("Malformed argument map: {0}", e.Message);
                    arg.IsMalformed = true;
                }
            }
            else
            {
                arg.Map = new Dictionary <string, IValue>();
            }

            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);
        }
Пример #4
0
        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;
        }
Пример #5
0
 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]));
 }
Пример #6
0
        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>();
            }
        }
Пример #7
0
 private static void PopulateArgumentMap(JToken jObject, ArgumentMap arg) {
     arg.Map = GetNonReservedProperties(jObject).ToDictionary(jt => jt.Name, jt => GetValue((JObject) jt.Value, jt.Name));
 }
Пример #8
0
        private static ArgumentMap CreateArgumentMap(JObject jObject, Action<JObject, ArgumentMap> populate) {
            var arg = new ArgumentMap();

            if (jObject != null) {
                try {
                    populate(jObject, arg);

                    arg.ValidateOnly = GetValidateOnlyFlag(jObject);
                    arg.DomainModel = GetDomainModelValue(jObject);
                    arg.SearchTerm = GetSearchTerm(jObject);
                }
                catch (Exception e) {
                    Logger.ErrorFormat("Malformed argument map: {0}", e.Message);
                    arg.IsMalformed = true;
                }
            }
            else {
                arg.Map = new Dictionary<string, IValue>();
            }

            return arg;
        }
 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));
 }