当前位置: 首页>>代码示例>>C#>>正文


C# Request.GetType方法代码示例

本文整理汇总了C#中Request.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Request.GetType方法的具体用法?C# Request.GetType怎么用?C# Request.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Request的用法示例。


在下文中一共展示了Request.GetType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetResponseTypeFor

        public Type GetResponseTypeFor(Request request)
        {
            if (request == null) throw new ArgumentNullException("request");
            var requestType = request.GetType();
            if (!requestResponseMappings.ContainsKey(requestType))
                throw new Exception("No response type found by convention for request type " + requestType);

            return requestResponseMappings[requestType];
        }
开发者ID:hoghweed,项目名称:Agatha,代码行数:9,代码来源:RequestHandlerBasedConventions.cs

示例2: AfterHandle

        protected override void AfterHandle(Request request)
        {
            base.AfterHandle(request);
            requestStopwatch.Stop();

            // TODO: make the 100ms limit configurable
            if (requestStopwatch.ElapsedMilliseconds > 100)
            {
                performanceLogger.Warn(string.Format("Performance warning: {0}ms for {1}", requestStopwatch.ElapsedMilliseconds, request.GetType().Name));
            }
        }
开发者ID:jochenvangasse,项目名称:Agatha,代码行数:11,代码来源:PerformanceLoggingRequestProcessor.cs

示例3: GetRequestHandlerTypeFor

 private static Type GetRequestHandlerTypeFor(Request request)
 {
     return typeof(IRequestHandler<>).MakeGenericType(request.GetType());
 }
开发者ID:hoghweed,项目名称:Agatha,代码行数:4,代码来源:RequestProcessingErrorHandler.cs

示例4: GetResponseTypeFor

        public Type GetResponseTypeFor(Request request)
        {
            if (request == null) throw new ArgumentNullException("request");

            return requestResponseMappings[request.GetType()];
        }
开发者ID:hoghweed,项目名称:Agatha,代码行数:6,代码来源:BasicConventions.cs

示例5: GetRequestInfo

 private static IEnumerable<string> GetRequestInfo(Request request) =>
     request.GetType().GetProperties().Select(p => $"<div>{p.Name}: {p.GetValue(request)}</div>");
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:2,代码来源:Program.cs

示例6: StoreInCache

 public virtual void StoreInCache(Request request, Response response)
 {
     var config = configuration.GetConfigurationFor(request.GetType());
     StoreInCache(request, response, config.Expiration, config.Region ?? DefaultRegionName);
 }
开发者ID:hoghweed,项目名称:Agatha,代码行数:5,代码来源:CacheManager.cs

示例7: GetCachedResponseFor

 public virtual Response GetCachedResponseFor(Request request)
 {
     return GetCachedResponseFor(request, configuration.GetRegionNameFor(request.GetType()) ?? DefaultRegionName);
 }
开发者ID:hoghweed,项目名称:Agatha,代码行数:4,代码来源:CacheManager.cs

示例8: BuildKey

 /// <summary>
 /// Gets the key.
 /// </summary>
 /// <param name="request">The request.</param>
 /// <returns></returns>
 protected virtual string BuildKey(Request request)
 {
     return string.Concat(request.GetType().Name, ":", request.GetHashCode());
 }
开发者ID:rickeygalloway,项目名称:Test,代码行数:9,代码来源:RequestProcessorCache.cs

示例9: listenerCallback


//.........这里部分代码省略.........
                                }
                                if (postTab[i].Length > 0)
                                {
                                    req.FormData.Add(postName, HttpUtility.UrlDecode(postTab[i]).Trim());
                                }

                            }
                        }
                    }
                    FeintSDK.RequestMethod actualMethod = FeintSDK.RequestMethod.POST;
                    switch (request.HttpMethod)
                    {
                        case "GET":
                            actualMethod = FeintSDK.RequestMethod.GET;
                            break;
                        case "POST":
                            actualMethod = FeintSDK.RequestMethod.POST;
                            break;
                        case "PUT":
                            actualMethod = FeintSDK.RequestMethod.PUT;
                            break;
                        case "DELETE":
                            actualMethod = FeintSDK.RequestMethod.DELETE;
                            break;
                    }
                    if (!req.Url.EndsWith("/"))
                        req.Url += "/";
                    for (int i = 0; i < FeintSDK.Settings.Urls.Count; i++)
                    {
                        var match = Regex.Match(req.Url.ToString(), FeintSDK.Settings.Urls[i].UrlMatch);

                        if (match.Success && (FeintSDK.Settings.Urls[i].Method == FeintSDK.RequestMethod.ALL || actualMethod == FeintSDK.Settings.Urls[i].Method))
                        {
                            setNonPublicSetProperty(req, req.GetType(), "Variables", match.Groups);

                            setSesion(request, response, req);
                            MethodInfo mi = FeintSDK.Settings.Urls[i].View.GetMethodInfo();
                            FeintSDK.AOPAttribute[] aops = (FeintSDK.AOPAttribute[])mi.GetCustomAttributes(typeof(FeintSDK.AOPAttribute), true);
                            res = null;
                            foreach (var aop in aops)
                            {
                                res = aop.PreRequest(req);
                            }
                            if (res == null)
                            {
                                res = FeintSDK.Settings.Urls[i].View(req);
                                if (res.MimeType != null)
                                {
                                    response.Headers.Add("Content-Type", res.MimeType + "; charset=utf-8");
                                }
                            }
                            var redirect = res.GetType().GetField("redirectUrl",
                             BindingFlags.NonPublic |
                             BindingFlags.Instance);
                            foreach (var aop in aops)
                            {
                                aop.PostRequest(req);
                            }
                            String url = (String)redirect.GetValue(res);
                            if (url != null)
                            {
                                //response.SeeOtherRedirect(url);
                                response.Redirect(url);

                                 response.Close();
                                return;
开发者ID:johniak,项目名称:FeintFramework,代码行数:67,代码来源:Server.cs

示例10: RequestTypeAllreadyUsedWithoutKey

 public bool RequestTypeAllreadyUsedWithoutKey(Request request)
 {
     return requestTypesUsed.Any(type => type == request.GetType());
 }
开发者ID:rickeygalloway,项目名称:Test,代码行数:4,代码来源:RequestDispatcherTestsState.cs


注:本文中的Request.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。