コード例 #1
0
        private static ArgumentMap CreateArgumentMap(JObject jObject, Action <JObject, ArgumentMap> populate)
        {
            var arg = new ArgumentMap();

            InitArgumentMap(jObject, populate, arg);

            return(arg);
        }
コード例 #2
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>();
            }
        }
コード例 #3
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);
        }
コード例 #4
0
        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));
        }
コード例 #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 PopulateArgumentMap(JToken jObject, ArgumentMap arg)
 {
     arg.Map = GetNonReservedProperties(jObject).ToDictionary(jt => jt.Name, jt => GetValue((JObject)jt.Value, jt.Name));
 }
コード例 #7
0
        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>();
            }
        }
コード例 #8
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]));
 }
コード例 #9
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;
        }
コード例 #10
0
        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));
        }
コード例 #11
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>();
            }
        }
コード例 #12
0
 private static void PopulateArgumentMap(JToken jObject, ArgumentMap arg) {
     arg.Map = GetNonReservedProperties(jObject).ToDictionary(jt => jt.Name, jt => GetValue((JObject) jt.Value, jt.Name));
 }
コード例 #13
0
        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>();
            }
        }
コード例 #14
0
        private static ArgumentMap CreateArgumentMap(JObject jObject, Action<JObject, ArgumentMap> populate) {
            var arg = new ArgumentMap();

            InitArgumentMap(jObject, populate, arg);

            return arg;
        }