public RouterService(
     IRouteEntryRegistry routeEntryRegistry,
     IRouteAuthorizationManager routeAuthorizationManager,
     ILogger logger)
 {
     _routeEntryRegistry           = routeEntryRegistry;
     _routeAuthorizationManager    = routeAuthorizationManager;
     InternalLogger.LoggerInstance = logger;
     _logger = logger
               .ForContext("RouterServiceId", RouterServiceId);
     _logger.Information("RouterService created with Id: {RouterServiceId}", RouterServiceId);
 }
示例#2
0
    public static Option <IRouteEntry> GetRouteEntry(ILogger logger, IRouteEntryRegistry routeEntryRegistry, string uri)
    {
        logger.Information($"Finding RouteEntry for uri: {uri}");
        var routeEntryMaybe = routeEntryRegistry.GetRouteEntry(uri);

        routeEntryMaybe.Match(
            routeEntry => logger.Information("Found RouteEntry, ViewType: {ViewType}", routeEntry.ViewType),
            () => logger.Warning("Did not find RouteEntry")
            );

        return(routeEntryMaybe);
    }
    public static RouteWorkflowTask Go(
        RouteRequest routeRequest,
        IRouteEntryRegistry routeEntryRegistry,
        IRouteAuthorizationManager routeAuthorizationManager,
        IRouterService routerService,
        ILogger logger)
    {
        var workflow = new RouteWorkflowTask(routeRequest, routeEntryRegistry, routeAuthorizationManager,
                                             routerService,
                                             logger);

        workflow.RouteResult = workflow.GoAsync();
        return(workflow);
    }
    internal RouteWorkflowTask(
        RouteRequest routeRequest,
        IRouteEntryRegistry routeEntryRegistry,
        IRouteAuthorizationManager routeAuthorizationManager,
        IRouterService routerService,
        ILogger logger)
    {
        _routeRequest = routeRequest;

        _routeEntryRegistry        = routeEntryRegistry;
        _routeAuthorizationManager = routeAuthorizationManager;
        _routerService             = routerService;
        _logger = logger
                  .ForContext(SerilogConstants.Serilog_SourceContext_Name, nameof(RouteWorkflowTask))
                  .ForContext("Uri", Uri)
                  .ForContext("ViewportName", ViewportOptions.ToString())
                  .ForContext("InitData", InitData)
                  .ForContext("RouterServiceId", _routerService.RouterServiceId)
                  .ForContext("RoutingWorkflowId", RoutingWorkflowId);
    }