Exemple #1
0
        public static void SetApiRequestConfig(this HttpContext context, bool logEnabled, bool allowPartialResponse, string controller, string action)
        {
            var feature = context.Features.Get <ApiManagerConfig>();

            if (feature == null)
            {
                feature = new ApiManagerConfig();
                context.Features.Set(feature);
            }

            feature.AllowPartialResponse = allowPartialResponse;
            feature.LogEnabled           = logEnabled;
            feature.Controller           = controller;
            feature.Action = action;
        }
Exemple #2
0
 internal static bool IsAllowPartialResponseEnabled(this HttpContext context, out ApiManagerConfig feature)
 {
     feature = context.Features.Get <ApiManagerConfig>();
     return(feature != null && feature.AllowPartialResponse);
 }
Exemple #3
0
 internal static bool IsLogEnabled(this HttpContext context, out ApiManagerConfig feature)
 {
     feature = context.Features.Get <ApiManagerConfig>();
     return(feature != null && feature.LogEnabled);
 }
Exemple #4
0
 internal static string GetAction(this HttpContext context, out ApiManagerConfig feature)
 {
     feature = context.Features.Get <ApiManagerConfig>();
     return(feature?.Action ?? "");
 }
Exemple #5
0
 internal static string GetController(this HttpContext context, out ApiManagerConfig feature)
 {
     feature = context.Features.Get <ApiManagerConfig>();
     return(feature?.Controller ?? "");
 }
Exemple #6
0
 public static void SetApiRequestConfig(this HttpContext context, ApiManagerConfig config)
 {
     context.SetApiRequestConfig(config.LogEnabled, config.AllowPartialResponse, config.Controller, config.Action);
 }