예제 #1
0
        public static StrObjectDict Union2 <T>(this IDictionary <string, object> dictionary1, T dictionary2) where T : System.Collections.Generic.IDictionary <string, object>
        {
            StrObjectDict strObjDict = new StrObjectDict();

            foreach (KeyValuePair <string, object> current in dictionary1.Union(dictionary2))
            {
                strObjDict.Add(current.Key, current.Value);
            }
            return(strObjDict);
        }
예제 #2
0
        public static StrObjectDict HttpDataToDict(this HttpRequestBase request, bool emptyAsKey)
        {
            //return new StrObjectDict().Merger(request.Form);
            if (request.ContentType.IndexOf("application/json") > -1)
            {
                try
                {
                    StreamReader reader = new StreamReader(request.InputStream, request.ContentEncoding);
                    string       req    = reader.ReadToEnd();
                    object       oi     = JsonAdapter.FromJsonAsDictionary(req);
                    return(StrObjectDict.FromVariable(oi, emptyAsKey));
                }
                catch (Exception)
                {
                    throw;
                }
            }

            var           o   = StrObjectDict.FromVariable(request.Form, emptyAsKey);
            StrObjectDict sod = new StrObjectDict();

            sod.Add("Params", o.Merger(request.QueryString));
            return(sod);
        }