private static ApiModel <TRequest> ApiModel <TRequest>(this IHaveServiceUrlsClient manager, TRequest request, ControllerName controllerName, string route = "") where TRequest : IRequest, new() { var hostType = controllerName.GetAttribute <HostUrlAttribute>().HostType; Uri.TryCreate($"http://localhost", UriKind.Absolute, out Uri referrer); return(new ApiModel <TRequest> { Referrer = referrer, Request = request, Route = route, ApiUrl = $"http://localhost", Controller = controllerName.ToString().ToLower(), Token = manager.ContextInfo.Token }); }
public LogFileManager(string filePathKey, string fileNameKey, ControllerName controllerName) { DateTime now = DateTime.Now; _fileIO = new FileIO( /// Param 1: Now now, /// Param 2: Path string.Format( ConfigAccess.GetValueInAppSettings(filePathKey), controllerName.ToString() ), /// Param 3: File Name string.Format( ConfigAccess.GetValueInAppSettings(fileNameKey), now.ToString(ConfigAccess.GetValueInAppSettings(LogKeys.LogDate)) )); }
public async Task InvokeAsync(HttpContext context) { RouteValueDictionary?RouteValues = context?.Request.RouteValues; IDisposable?Group = null; if (RouteValues != null && RouteValues.TryGetValue("controller", out object ControllerName)) { Group = _Logger.BeginGroup(ControllerName.ToString()); } try { await _Next(context).ConfigureAwait(false); } finally { Group?.Dispose(); } }