public static IApplicationBuilder UseViewConfig(this IApplicationBuilder app, Action <ViewConfigOptions> options = null) { ViewConfigOptions opt = new ViewConfigOptions(); if (options != null) { options.Invoke(opt); } if (string.IsNullOrEmpty(opt.Endpoint)) { opt.Endpoint = "/viewconfig"; } if (string.IsNullOrEmpty(opt.Render)) { opt.Render = "page"; } return(app.UseMiddleware <ViewConfigMiddleware>(opt)); }
public static ViewConfigOptions Map(this ViewConfigOptions options, string endpoint = "/viewconfig") { options.Endpoint = endpoint; return(options); }
public static ViewConfigOptions RenderJson(this ViewConfigOptions options) { options.Render = "json"; return(options); }
public static ViewConfigOptions RenderText(this ViewConfigOptions options) { options.Render = "text"; return(options); }
public static ViewConfigOptions RenderPage(this ViewConfigOptions options) { options.Render = "page"; return(options); }