コード例 #1
0
        public OwinRequestData(RouteData routeData, OwinRequestBody body)
        {
            AddValues(new RouteDataValues(routeData));

            AddValues(Querystring, new DictionaryKeyValues(body.Querystring()));
            AddValues(FormPost, new DictionaryKeyValues(body.FormData ?? new Dictionary <string, string>()));

            AddValues(RequestDataSource.Header.ToString(), new DictionaryKeyValues(body.Headers()));
        }
コード例 #2
0
ファイル: OwinRequestData.cs プロジェクト: roynmoore/fubumvc
        public OwinRequestData(RouteData routeData, OwinRequestBody body)
        {
            AddValues(new RouteDataValues(routeData));

            AddValues("OwinQuerystring", new DictionaryKeyValues(body.Querystring()));
            AddValues("OwinFormPost", new DictionaryKeyValues(body.FormData ?? new Dictionary<string, string>()));

            AddValues(RequestDataSource.Header.ToString(), new DictionaryKeyValues(body.Headers()));
        }
コード例 #3
0
        public OwinAggregateDictionary(RouteData routeData, OwinRequestBody body)
        {
            Func <string, object> locator = key =>
            {
                object found;
                routeData.Values.TryGetValue(key, out found);
                return(found);
            };

            AddLocator(RequestDataSource.Route.ToString(), locator, () => routeData.Values.Keys);
            AddLocator(RequestDataSource.Request.ToString(), key => findRequestValue(key, body), () => valuesForRequest(body).Keys);

            addDictionaryLocator("Query string", body.Querystring());
            addDictionaryLocator("Form Post", body.FormData ?? new Dictionary <string, string>());
            addDictionaryLocator(RequestDataSource.Header.ToString(), body.Headers());
        }
コード例 #4
0
        public OwinAggregateDictionary(RouteData routeData, OwinRequestBody body)
        {
            Func<string, object> locator = key =>
            {
                object found;
                routeData.Values.TryGetValue(key, out found);
                return found;
            };

            AddLocator(RequestDataSource.Route.ToString(), locator, () => routeData.Values.Keys);
            AddLocator(RequestDataSource.Request.ToString(), key => findRequestValue(key, body), () => valuesForRequest(body).Keys);

            addDictionaryLocator("Query string", body.Querystring());
            addDictionaryLocator("Form Post", body.FormData ?? new Dictionary<string, string>());
            addDictionaryLocator(RequestDataSource.Header.ToString(), body.Headers());
        }
コード例 #5
0
        public OwinAggregateDictionary(RouteData routeData, OwinRequestBody body)
        {
            // TODO -- this is duplication w/ AspNetAggregateDictionary.  DRY it baby!
            Func<string, object> locator = key =>
            {
                object found;
                routeData.Values.TryGetValue(key, out found);
                return found;
            };

            AddLocator(RequestDataSource.Route.ToString(), locator, () => routeData.Values.Keys);

            addDictionaryLocator("Query string", body.Querystring());
            addDictionaryLocator("Form Post", body.FormData ?? new Dictionary<string, string>());

            addDictionaryLocator(RequestDataSource.Header.ToString(), body.Headers());
        }
コード例 #6
0
        public OwinAggregateDictionary(RouteData routeData, OwinRequestBody body)
        {
            // TODO -- this is duplication w/ AspNetAggregateDictionary.  DRY it baby!
            Func <string, object> locator = key =>
            {
                object found;
                routeData.Values.TryGetValue(key, out found);
                return(found);
            };


            AddLocator(RequestDataSource.Route.ToString(), locator, () => routeData.Values.Keys);

            addDictionaryLocator("Query string", body.Querystring());
            addDictionaryLocator("Form Post", body.FormData ?? new Dictionary <string, string>());

            addDictionaryLocator(RequestDataSource.Header.ToString(), body.Headers());
        }
コード例 #7
0
        private static IDictionary<string, string> valuesForRequest(OwinRequestBody body)
        {
            var dictionary = new Dictionary<string, string>();
            var queryString = body.Querystring();
            foreach(var key in queryString.Keys)
            {
                dictionary.Add(key, queryString[key]);
            }

            IDictionary<string, string> formData = body.FormData ?? new Dictionary<string, string>();
            foreach (var key in formData.Keys.Where(x => x != null))
            {
                if(!dictionary.ContainsKey(key))
                {
                    dictionary.Add(key, formData[key]);
                }
            }

            return dictionary;
        }
コード例 #8
0
        private static IDictionary <string, string> valuesForRequest(OwinRequestBody body)
        {
            var dictionary  = new Dictionary <string, string>();
            var queryString = body.Querystring();

            foreach (var key in queryString.Keys)
            {
                dictionary.Add(key, queryString[key]);
            }

            IDictionary <string, string> formData = body.FormData ?? new Dictionary <string, string>();

            foreach (var key in formData.Keys.Where(x => x != null))
            {
                if (!dictionary.ContainsKey(key))
                {
                    dictionary.Add(key, formData[key]);
                }
            }

            return(dictionary);
        }