/// <summary>
 /// Constructor.
 /// </summary>
 public CSClassroomTelemetryInitializer(
     IHttpContextAccessor httpContextAccessor,
     IActionContextAccessor actionContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
     _actionContextAccessor = actionContextAccessor;
 }
Exemplo n.º 2
0
 public TestResponseGenerator(IActionContextAccessor contextAccessor)
 {
     _actionContext = contextAccessor.ActionContext;
     if (_actionContext == null)
     {
         throw new InvalidOperationException("ActionContext should not be null here.");
     }
 }
Exemplo n.º 3
0
 public CustomUrlHelper(
     IActionContextAccessor contextAccessor,
     IActionSelector actionSelector,
     IOptions<AppOptions> appOptions)
     : base(contextAccessor, actionSelector)
 {
     _appOptions = appOptions;
     _httpContext = contextAccessor.ActionContext.HttpContext;
 }
Exemplo n.º 4
0
        public BundleModel(IUrlManager urlManager, IActionContextAccessor accessor)
            : base("bundle", urlManager, accessor)
        {
            if (!ParsedPath.Names.Any())
            {
                throw new InvalidOperationException("The bundle route value does not contain a bundle name");
            }

            _bundleName = ParsedPath.Names.Single();
        }
Exemplo n.º 5
0
        public EventRepository(ISpeakerRepository speakerRepository, IOptions<AppSettings> appSettings, IServiceProvider serviceProvider, IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccessor)
        {
            this.speakerRepository = speakerRepository;
            this.serviceProvider = serviceProvider;
            this.appSettings = appSettings;
            this.urlHelperFactory = urlHelperFactory;
            this.actionContextAccessor = actionContextAccessor;
            loadData().Wait();

        }
 public PagerTagHelper(
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccesor,
     //IHtmlGenerator generator, 
     IBuildPaginationLinks linkBuilder = null)
 {
     //Generator = generator;
     this.linkBuilder = linkBuilder ?? new PaginationLinkBuilder();
     this.urlHelperFactory = urlHelperFactory;
     this.actionContextAccesor = actionContextAccesor;
 }
Exemplo n.º 7
0
		public RouteJs(
			IEnumerable<IRouteFetcher> routeFetchers,
			IActionContextAccessor actionContextAccessor,
			IEnumerable<IRouteFilter> routeFilters,
			IRouteJsConfiguration routeJsConfiguration
		)
		{
			_routeFetchers = routeFetchers;
			_routeFilters = routeFilters;
			_actionContext = actionContextAccessor.ActionContext;
			_routeJsConfiguration = routeJsConfiguration;
		}
 public NavigationTreeSiteMapNodeService(
     NavigationTreeBuilderService siteMapTreeBuilder,
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccesor,
     IHttpContextAccessor contextAccessor,
     ILogger<NavigationTreeSiteMapNodeService> logger)
 {
     this.siteMapTreeBuilder = siteMapTreeBuilder;
     this.urlHelperFactory = urlHelperFactory;
     this.actionContextAccesor = actionContextAccesor;
     this.contextAccessor = contextAccessor; 
     log = logger;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes an instance of <see cref="FormatFilter"/>.
        /// </summary>
        /// <param name="options">The <see cref="IOptions{MvcOptions}"/></param>
        /// <param name="actionContextAccessor">The <see cref="IActionContextAccessor"/></param>
        public FormatFilter(IOptions<MvcOptions> options, IActionContextAccessor actionContextAccessor)
        {
            IsActive = true;
            Format = GetFormat(actionContextAccessor.ActionContext);

            if (string.IsNullOrEmpty(Format))
            {
                IsActive = false;
                return;
            }

            ContentType = options.Options.FormatterMappings.GetMediaTypeMappingForFormat(Format);
        }
Exemplo n.º 10
0
        public IssuesController(IUserAuthHelper userSessionHelper,
            IProjectManager projectManager, IIssueManager issueManager,
            ITeamManager teamManager, IUploadHandler uploadHandler,
            IUploadManager uploadManager, IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccessor) //: base(repositary)
        {
            this._issueManager = issueManager;
            this._projectManager = projectManager;
            this._userSessionHelper = userSessionHelper;
            this._teamManager = teamManager;
            this._uploadHandler = uploadHandler;
            this._uploadManager = uploadManager;
            this._urlHelper = urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext);

        }
Exemplo n.º 11
0
        public MvcRouteHandler(
            IActionInvokerFactory actionInvokerFactory,
            IActionSelector actionSelector,
            DiagnosticSource diagnosticSource,
            ILoggerFactory loggerFactory,
            IActionContextAccessor actionContextAccessor)
        {
            // The IActionContextAccessor is optional. We want to avoid the overhead of using CallContext
            // if possible.
            _actionContextAccessor = actionContextAccessor;

            _actionInvokerFactory = actionInvokerFactory;
            _actionSelector = actionSelector;
            _diagnosticSource = diagnosticSource;
            _logger = loggerFactory.CreateLogger<MvcRouteHandler>();
        }
 public ShapeTemplateBindingStrategy(
     IEnumerable<IShapeTemplateHarvester> harvesters,
     IFeatureManager featureManager,
     IEnumerable<IShapeTemplateViewEngine> shapeTemplateViewEngines,
     IOptions<MvcViewOptions> options,
     IActionContextAccessor actionContextAccessor,
     IOrchardFileSystem fileSystem,
     ILogger<DefaultShapeTableManager> logger)
 {
     _harvesters = harvesters;
     _featureManager = featureManager;
     _shapeTemplateViewEngines = shapeTemplateViewEngines;
     _viewEngine = options;
     _actionContextAccessor = actionContextAccessor;
     _fileSystem = fileSystem;
     _logger = logger;
 }
 public ShapeTemplateBindingStrategy(
     IEnumerable<IShapeTemplateHarvester> harvesters,
     ShellDescriptor shellDescriptor,
     IExtensionManager extensionManager,
     IVirtualPathProvider virtualPathProvider,
     IEnumerable<IShapeTemplateViewEngine> shapeTemplateViewEngines,
     IOptions<MvcViewOptions> options,
     IActionContextAccessor actionContextAccessor,
     ILogger<DefaultShapeTableManager> logger)
 {
     _harvesters = harvesters;
     _shellDescriptor = shellDescriptor;
     _extensionManager = extensionManager;
     _virtualPathProvider = virtualPathProvider;
     _shapeTemplateViewEngines = shapeTemplateViewEngines;
     _viewEngine = options;
     _actionContextAccessor = actionContextAccessor;
     _logger = logger;
 }
Exemplo n.º 14
0
        public async Task <IActionResult> CountBuildingUnitsV2(
            [FromQuery] int?adresObjectId,
            [FromServices] IActionContextAccessor actionContextAccessor,
            [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch,
            [FromServices] IsBuildingUnitOsloApiEnabledToggle featureToggle,
            CancellationToken cancellationToken = default)
        {
            if (!featureToggle.FeatureEnabled)
            {
                return(NotFound());
            }

            var contentFormat = DetermineFormat(actionContextAccessor.ActionContext);

            IRestRequest BackendRequest() => CreateBackendCountRequest(adresObjectId);

            return(new BackendResponseResult(
                       await GetFromBackendAsync(
                           contentFormat.ContentType,
                           BackendRequest,
                           CreateDefaultHandleBadRequest(),
                           cancellationToken)));
        }
Exemplo n.º 15
0
        protected RequestModel(string valueName, IUrlManager urlManager, IActionContextAccessor accessor)
        {
            //default 
            LastFileWriteTime = DateTime.Now;

            Compression = accessor.ActionContext.HttpContext.Request.GetClientCompression();

            var bundleId = (string)accessor.ActionContext.RouteData.Values[valueName];
            ParsedPath = urlManager.ParsePath(bundleId);

            switch (ParsedPath.WebType)
            {
                case WebFileType.Js:
                    Extension = ".js";
                    Mime = "text/javascript";
                    break;
                case WebFileType.Css:
                default:
                    Extension = ".css";
                    Mime = "text/css";
                    break;
            }
        }
Exemplo n.º 16
0
        private void EnsureServices(HttpContext context)
        {
            if (_servicesRetrieved)
            {
                return;
            }

            var services = context.RequestServices;

            // The IActionContextAccessor is optional. We want to avoid the overhead of using CallContext
            // if possible.
            _actionContextAccessor = services.GetService <IActionContextAccessor>();

            _actionInvokerFactory = services.GetRequiredService <IActionInvokerFactory>();
            _actionSelector       = services.GetRequiredService <IActionSelector>();
            _diagnosticSource     = services.GetRequiredService <DiagnosticSource>();

            var factory = services.GetRequiredService <ILoggerFactory>();

            _logger = factory.CreateLogger <MvcRouteHandler>();

            _servicesRetrieved = true;
        }
 public YuansferPaymentProcessor(CurrencySettings currencySettings,
                                 IActionContextAccessor actionContextAccessor,
                                 ICurrencyService currencyService,
                                 ILocalizationService localizationService,
                                 INotificationService notificationService,
                                 IOrderService orderService,
                                 IOrderTotalCalculationService orderTotalCalculationService,
                                 IPaymentService paymentService,
                                 IProductAttributeFormatter productAttributeFormatter,
                                 IProductService productService,
                                 ISettingService settingService,
                                 IUrlHelperFactory urlHelperFactory,
                                 IWebHelper webHelper,
                                 IWorkContext workContext,
                                 YuansferApi yuansferApi,
                                 YuansferService yuansferService,
                                 YuansferPaymentSettings yuansferPaymentSettings
                                 )
 {
     _currencySettings             = currencySettings;
     _actionContextAccessor        = actionContextAccessor;
     _currencyService              = currencyService;
     _localizationService          = localizationService;
     _notificationService          = notificationService;
     _orderService                 = orderService;
     _orderTotalCalculationService = orderTotalCalculationService;
     _paymentService               = paymentService;
     _productAttributeFormatter    = productAttributeFormatter;
     _productService               = productService;
     _settingService               = settingService;
     _urlHelperFactory             = urlHelperFactory;
     _webHelper               = webHelper;
     _workContext             = workContext;
     _yuansferApi             = yuansferApi;
     _yuansferService         = yuansferService;
     _yuansferPaymentSettings = yuansferPaymentSettings;
 }
        public async Task <IActionResult> ListParcels(
            [FromQuery] int?offset,
            [FromQuery] int?limit,
            [FromQuery] string sort,
            [FromQuery] string status,
            [FromServices] IActionContextAccessor actionContextAccessor,
            [FromServices] IOptions <ParcelOptions> responseOptions,
            [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch,
            CancellationToken cancellationToken = default)
        {
            var        contentFormat = DetermineFormat(actionContextAccessor.ActionContext);
            const Taal taal          = Taal.NL;

            IRestRequest BackendRequest() => CreateBackendListRequest(
                offset,
                limit,
                taal,
                sort,
                status);

            var cacheKey = CreateCacheKeyForRequestQuery($"legacy/parcel-list:{taal}");

            var value = await(CacheToggle.FeatureEnabled
                ? GetFromCacheThenFromBackendAsync(
                                  contentFormat.ContentType,
                                  BackendRequest,
                                  cacheKey,
                                  CreateDefaultHandleBadRequest(),
                                  cancellationToken)
                : GetFromBackendAsync(
                                  contentFormat.ContentType,
                                  BackendRequest,
                                  CreateDefaultHandleBadRequest(),
                                  cancellationToken));

            return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.VolgendeUrl));
        }
        public UpdateFullUserModelValidator
        (
            IUserRepository userRepository,
            IRoleRepository roleRepository,
            IStringLocalizer <ValidatorMessages> stringLocalizer,
            IActionContextAccessor actionContextAccessor
        ) : base(stringLocalizer, actionContextAccessor)
        {
            _userRepository = userRepository;
            _roleRepository = roleRepository;

            RuleFor(user => user.FirstName)
            .NotEmpty().WithMessage(_stringLocalizer["EmptyField"])
            .MaximumLength(32).WithMessage(_stringLocalizer["TooLong"]);

            RuleFor(user => user.LastName)
            .NotEmpty().WithMessage(_stringLocalizer["EmptyField"])
            .MaximumLength(32).WithMessage(_stringLocalizer["TooLong"]);

            RuleFor(user => user.Email)
            .NotEmpty().WithMessage(_stringLocalizer["EmptyField"])
            .MaximumLength(250).WithMessage(_stringLocalizer["TooLong"])
            .EmailAddress().WithMessage(_stringLocalizer["WrongEmail"])
            .MustAsync(CheckEmailAsync).WithMessage(_stringLocalizer["UniqueEmail"]);

            RuleFor(user => user.Status)
            .MaximumLength(250).WithMessage(_stringLocalizer["TooLong"]);

            RuleFor(user => user.Roles)
            .NotEmpty().WithMessage(_stringLocalizer["EmptyField"])
            .MustAsync(CheckRoleAsync).WithMessage(_stringLocalizer["WrongRole"]);

            RuleFor(user => user.UserName)
            .NotEmpty().WithMessage(_stringLocalizer["EmptyField"])
            .MaximumLength(32).WithMessage(_stringLocalizer["TooLong"])
            .MustAsync(CheckUserNameAsync).WithMessage(_stringLocalizer["UniqueUserName"]);
        }
Exemplo n.º 20
0
 public PageService(
     IProjectService projectService,
     IProjectSecurityResolver security,
     IPageQueries pageQueries,
     IPageCommands pageCommands,
     IMediaProcessor mediaProcessor,
     IUrlHelperFactory urlHelperFactory,
     IMemoryCache cache,
     IPageNavigationCacheKeys cacheKeys,
     IActionContextAccessor actionContextAccesor,
     IHttpContextAccessor contextAccessor = null)
 {
     this.projectService       = projectService;
     this.security             = security;
     this.pageQueries          = pageQueries;
     this.pageCommands         = pageCommands;
     context                   = contextAccessor?.HttpContext;
     this.mediaProcessor       = mediaProcessor;
     this.urlHelperFactory     = urlHelperFactory;
     this.actionContextAccesor = actionContextAccesor;
     htmlProcessor             = new HtmlProcessor();
     this.cache                = cache;
     this.cacheKeys            = cacheKeys;
 }
Exemplo n.º 21
0
        public JsonStringLocalizer(
            string resourceBaseName,
            IHostingEnvironment env,
            JsonGlobalResources globalResources,
            RequestCulture defaultCulture,
            IActionContextAccessor actionContextAccessor,
            JsonLocalizationOptions options,
            ILoggerFactory loggerFactory)
        {
            _options               = options ?? throw new ArgumentNullException(nameof(options));
            _env                   = env ?? throw new ArgumentNullException(nameof(env));
            GlobalResources        = globalResources ?? throw new ArgumentNullException(nameof(globalResources));
            DefaultCulture         = defaultCulture ?? throw new ArgumentNullException(nameof(defaultCulture));
            _actionContextAccessor = actionContextAccessor ?? throw new ArgumentNullException(nameof(actionContextAccessor));
            _logger                = loggerFactory.CreateLogger <JsonStringLocalizer <T> >();

            _resourcesRelativePath = _options.ResourcesPath ?? string.Empty;
            if (!string.IsNullOrEmpty(_resourcesRelativePath))
            {
                _resourcesRelativePath = _resourcesRelativePath.Replace(Path.AltDirectorySeparatorChar, '.').Replace(Path.DirectorySeparatorChar, '.');
            }

            ResourceFileLocations = LocalizerUtil.ExpandPaths(resourceBaseName).ToList();
        }
Exemplo n.º 22
0
 public CommonModelFactory(AdminAreaSettings adminAreaSettings,
                           IActionContextAccessor actionContextAccessor,
                           IUserService userService,
                           IDateTimeHelper dateTimeHelper,
                           IExternalAuthenticationService externalAuthenticationService,
                           INopFileProvider fileProvider,
                           IHttpContextAccessor httpContextAccessor,
                           ILanguageService languageService,
                           ILocalizationService localizationService,
                           IMaintenanceService maintenanceService,
                           IPluginFinder pluginFinder,
                           ISearchTermService searchTermService,
                           IUrlHelperFactory urlHelperFactory,
                           IUrlRecordService urlRecordService,
                           IWebHelper webHelper,
                           IWidgetService widgetService,
                           IWorkContext workContext)
 {
     this._adminAreaSettings             = adminAreaSettings;
     this._actionContextAccessor         = actionContextAccessor;
     this._userService                   = userService;
     this._dateTimeHelper                = dateTimeHelper;
     this._externalAuthenticationService = externalAuthenticationService;
     this._fileProvider                  = fileProvider;
     this._httpContextAccessor           = httpContextAccessor;
     this._languageService               = languageService;
     this._localizationService           = localizationService;
     this._maintenanceService            = maintenanceService;
     this._pluginFinder                  = pluginFinder;
     this._searchTermService             = searchTermService;
     this._urlHelperFactory              = urlHelperFactory;
     this._urlRecordService              = urlRecordService;
     this._webHelper     = webHelper;
     this._widgetService = widgetService;
     this._workContext   = workContext;
 }
 public PaymentMethod(IActionContextAccessor actionContextAccessor,
                      ICurrencyService currencyService,
                      IGenericAttributeService genericAttributeService,
                      ILocalizationService localizationService,
                      ISettingService settingService,
                      IStoreService storeService,
                      IUrlHelperFactory urlHelperFactory,
                      CurrencySettings currencySettings,
                      PayPalSmartPaymentButtonsSettings settings,
                      ServiceManager serviceManager,
                      WidgetSettings widgetSettings)
 {
     _actionContextAccessor   = actionContextAccessor;
     _currencyService         = currencyService;
     _genericAttributeService = genericAttributeService;
     _localizationService     = localizationService;
     _settingService          = settingService;
     _storeService            = storeService;
     _urlHelperFactory        = urlHelperFactory;
     _currencySettings        = currencySettings;
     _settings       = settings;
     _serviceManager = serviceManager;
     _widgetSettings = widgetSettings;
 }
Exemplo n.º 24
0
 public BlogService(
     IProjectService projectService,
     IProjectSecurityResolver security,
     IPostQueries postQueries,
     IPostCommands postCommands,
     IMediaProcessor mediaProcessor,
     IBlogRoutes blogRoutes,
     PostEvents eventHandlers,
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccesor,
     IHttpContextAccessor contextAccessor = null)
 {
     this.security             = security;
     this.postQueries          = postQueries;
     this.postCommands         = postCommands;
     context                   = contextAccessor?.HttpContext;
     this.mediaProcessor       = mediaProcessor;
     this.urlHelperFactory     = urlHelperFactory;
     this.actionContextAccesor = actionContextAccesor;
     this.projectService       = projectService;
     htmlProcessor             = new HtmlProcessor();
     this.blogRoutes           = blogRoutes;
     this.eventHandlers        = eventHandlers;
 }
 public NavigationViewComponent(
     NavigationTreeBuilderService siteMapTreeBuilder,
     IEnumerable <INavigationNodePermissionResolver> permissionResolvers,
     IEnumerable <IFindCurrentNode> nodeFinders,
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccesor,
     INodeUrlPrefixProvider prefixProvider,
     ILogger <NavigationViewComponent> logger)
 {
     builder = siteMapTreeBuilder;
     this.permissionResolvers  = permissionResolvers;
     this.nodeFinders          = nodeFinders;
     this.urlHelperFactory     = urlHelperFactory;
     this.actionContextAccesor = actionContextAccesor;
     if (prefixProvider == null)
     {
         this.prefixProvider = new DefaultNodeUrlPrefixProvider();
     }
     else
     {
         this.prefixProvider = prefixProvider;
     }
     log = logger;
 }
Exemplo n.º 26
0
        public IActionResult Index([FromServices] IServiceProvider serviceProvider, [FromServices] IActionContextAccessor actionContextAccessor)
        {
            if (User?.Identity?.IsAuthenticated != true &&
                (bool)RouteData.DataTokens["RequireAuthenticated"])
            {
                return(RedirectToAction("Login", "Account"));
            }

            var layout = _layoutManager.LayoutForRoute(RouteData.DataTokens["RouteName"] as string);
            var pluginViewComponentName = RouteData.DataTokens["ViewComponent"] as string;

            return(View(new ViewComponentViewModel
            {
                ViewComponent = "PluginLayout",
                Arguments = new object[] {
                    _layoutManager.PathForLayoutView(layout),
                    new ViewComponentViewModel
                    {
                        ViewComponent = pluginViewComponentName,
                        Arguments = null
                    }
                }
            }));
        }
 public IyzicoPaymentProcessor(ISettingService settingService, IPaymentIyzicoService iyzicoService, IyzicoPaymentSettings iyzicoPaymentSettings, IWebHelper webHelper, ILocalizationService localizationService, ICustomerService customerService, IAddressService addressService, IProductService productService, ICategoryService categoryService, IShoppingCartService shoppingCartService, IPriceCalculationService priceCalculationService, IPaymentService paymentService, IHttpContextAccessor httpContextAccessor, IOrderTotalCalculationService orderTotalCalculationService, IWorkContext workContext, IShippingPluginManager shippingPluginManager, IStoreContext storeContext, IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccessor, ITaxService taxService, ICurrencyService currencyService)
 {
     this._settingService               = settingService;
     this._iyzicoService                = iyzicoService;
     this._iyzicoPaymentSettings        = iyzicoPaymentSettings;
     this._webHelper                    = webHelper;
     this._localizationService          = localizationService;
     this._customerService              = customerService;
     this._addressService               = addressService;
     this._productService               = productService;
     this._categoryService              = categoryService;
     this._shoppingCartService          = shoppingCartService;
     this._priceCalculationService      = priceCalculationService;
     this._paymentService               = paymentService;
     this._httpContextAccessor          = httpContextAccessor;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._workContext                  = workContext;
     this._shippingPluginManager        = shippingPluginManager;
     this._storeContext                 = storeContext;
     this._urlHelperFactory             = urlHelperFactory;
     this._actionContextAccessor        = actionContextAccessor;
     this._taxService                   = taxService;
     this._currencyService              = currencyService;
 }
Exemplo n.º 28
0
 public SitemapGenerator(BlogSettings blogSettings,
                         CommonSettings commonSettings,
                         ForumSettings forumSettings,
                         IActionContextAccessor actionContextAccessor,
                         ICategoryService categoryService,
                         ILanguageService languageService,
                         IManufacturerService manufacturerService,
                         IProductService productService,
                         IProductTagService productTagService,
                         IStoreContext storeContext,
                         ITopicService topicService,
                         IUrlHelperFactory urlHelperFactory,
                         IUrlRecordService urlRecordService,
                         IWebHelper webHelper,
                         LocalizationSettings localizationSettings,
                         NewsSettings newsSettings,
                         SecuritySettings securitySettings)
 {
     this._blogSettings          = blogSettings;
     this._commonSettings        = commonSettings;
     this._forumSettings         = forumSettings;
     this._actionContextAccessor = actionContextAccessor;
     this._categoryService       = categoryService;
     this._languageService       = languageService;
     this._manufacturerService   = manufacturerService;
     this._productService        = productService;
     this._productTagService     = productTagService;
     this._storeContext          = storeContext;
     this._topicService          = topicService;
     this._urlHelperFactory      = urlHelperFactory;
     this._urlRecordService      = urlRecordService;
     this._webHelper             = webHelper;
     this._localizationSettings  = localizationSettings;
     this._newsSettings          = newsSettings;
     this._securitySettings      = securitySettings;
 }
 public NavigationViewComponent(
     NavigationTreeBuilderService siteMapTreeBuilder,
     IEnumerable<INavigationNodePermissionResolver> permissionResolvers,
     IEnumerable<IFindCurrentNode> nodeFinders,
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccesor,
     INodeUrlPrefixProvider prefixProvider,
     ILogger<NavigationViewComponent> logger)
 {
     builder = siteMapTreeBuilder;
     this.permissionResolvers = permissionResolvers;
     this.nodeFinders = nodeFinders;
     this.urlHelperFactory = urlHelperFactory;
     this.actionContextAccesor = actionContextAccesor;
     if (prefixProvider == null)
     {
         this.prefixProvider = new DefaultNodeUrlPrefixProvider();
     }
     else
     {
         this.prefixProvider = prefixProvider;
     }
     log = logger;
 }
 public SendinBlueMarketingAutomationManager(CurrencySettings currencySettings,
                                             IActionContextAccessor actionContextAccessor,
                                             ICurrencyService currencyService,
                                             IGenericAttributeService genericAttributeService,
                                             ILogger logger,
                                             IOrderTotalCalculationService orderTotalCalculationService,
                                             IPictureService pictureService,
                                             IPriceCalculationService priceCalculationService,
                                             IProductAttributeParser productAttributeParser,
                                             IShippingPluginManager shippingPluginManager,
                                             IShoppingCartService shoppingCartService,
                                             IStoreContext storeContext,
                                             IUrlHelperFactory urlHelperFactory,
                                             IUrlRecordService urlRecordService,
                                             IWebHelper webHelper,
                                             IWorkContext workContext,
                                             SendinBlueSettings sendinBlueSettings)
 {
     _currencySettings        = currencySettings;
     _actionContextAccessor   = actionContextAccessor;
     _currencyService         = currencyService;
     _genericAttributeService = genericAttributeService;
     _logger = logger;
     _orderTotalCalculationService = orderTotalCalculationService;
     _pictureService          = pictureService;
     _priceCalculationService = priceCalculationService;
     _productAttributeParser  = productAttributeParser;
     _shippingPluginManager   = shippingPluginManager;
     _shoppingCartService     = shoppingCartService;
     _storeContext            = storeContext;
     _urlHelperFactory        = urlHelperFactory;
     _urlRecordService        = urlRecordService;
     _webHelper          = webHelper;
     _workContext        = workContext;
     _sendinBlueSettings = sendinBlueSettings;
 }
Exemplo n.º 31
0
        public UsuarioService(IOptions <AppSettings> appSettings,
                              IRepositoryWrapper repoWrapper,
                              IEmailService emailService,
                              IResultService resultService,
                              IOptions <EmailSettings> emailConfiguration,
                              IActionContextAccessor accessor)
        {
            if (appSettings.IsNull())
            {
                throw new Exception("No están definidos los parámetros en el archivo de configuración del sistema");
            }

            _appSettings   = appSettings.Value;
            _repoWrapper   = repoWrapper;
            _emailService  = emailService;
            _resultService = resultService;

            if (!emailConfiguration.IsNull())
            {
                _emailConfiguration = emailConfiguration.Value;
            }

            _accessor = accessor;
        }
Exemplo n.º 32
0
 public PageRequestDelegateFactory(
     PageActionInvokerCache cache,
     IModelMetadataProvider modelMetadataProvider,
     ITempDataDictionaryFactory tempDataFactory,
     IOptions <MvcOptions> mvcOptions,
     IOptions <MvcViewOptions> mvcViewOptions,
     IPageHandlerMethodSelector selector,
     DiagnosticListener diagnosticListener,
     ILoggerFactory loggerFactory,
     IActionResultTypeMapper mapper,
     IActionContextAccessor?actionContextAccessor = null)
 {
     _cache = cache;
     _valueProviderFactories = mvcOptions.Value.ValueProviderFactories.ToArray();
     _modelMetadataProvider  = modelMetadataProvider;
     _tempDataFactory        = tempDataFactory;
     _mvcViewOptions         = mvcViewOptions.Value;
     _enableActionInvokers   = mvcOptions.Value.EnableActionInvokers;
     _selector              = selector;
     _diagnosticListener    = diagnosticListener;
     _logger                = loggerFactory.CreateLogger <PageActionInvoker>();
     _mapper                = mapper;
     _actionContextAccessor = actionContextAccessor ?? ActionContextAccessor.Null;
 }
Exemplo n.º 33
0
        public async Task <IActionResult> ListCrabBuildings(
            [FromQuery] int?terreinObjectId,
            [FromQuery] string identificatorTerreinObject,
            [FromServices] IActionContextAccessor actionContextAccessor,
            [FromServices] IOptions <AddressOptions> responseOptions,
            [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch,
            CancellationToken cancellationToken = default)
        {
            var contentFormat = DetermineFormat(actionContextAccessor.ActionContext);

            if (!terreinObjectId.HasValue && string.IsNullOrEmpty(identificatorTerreinObject))
            {
                throw new ApiException("Er dient minstens één identificator als input te worden meegegeven.", StatusCodes.Status400BadRequest);
            }

            IRestRequest BackendRequest() => CreateBackendListRequest(
                terreinObjectId,
                identificatorTerreinObject);

            var cacheKey = CreateCacheKeyForRequestQuery($"legacy/crabgebouwen-list:{Taal.NL}");

            var value = await(CacheToggle.FeatureEnabled
                ? GetFromCacheThenFromBackendAsync(
                                  contentFormat.ContentType,
                                  BackendRequest,
                                  cacheKey,
                                  CreateDefaultHandleBadRequest(),
                                  cancellationToken)
                : GetFromBackendAsync(
                                  contentFormat.ContentType,
                                  BackendRequest,
                                  CreateDefaultHandleBadRequest(),
                                  cancellationToken));

            return(BackendListResponseResult.Create(value, Request.Query, string.Empty));
        }
Exemplo n.º 34
0
 public TopicModelFactory(CatalogSettings catalogSettings,
                          IAclSupportedModelFactory aclSupportedModelFactory,
                          IActionContextAccessor actionContextAccessor,
                          IBaseAdminModelFactory baseAdminModelFactory,
                          ILocalizationService localizationService,
                          ILocalizedModelFactory localizedModelFactory,
                          IStoreMappingSupportedModelFactory storeMappingSupportedModelFactory,
                          ITopicService topicService,
                          IUrlHelperFactory urlHelperFactory,
                          IUrlRecordService urlRecordService,
                          IWebHelper webHelper)
 {
     _catalogSettings                   = catalogSettings;
     _aclSupportedModelFactory          = aclSupportedModelFactory;
     _actionContextAccessor             = actionContextAccessor;
     _baseAdminModelFactory             = baseAdminModelFactory;
     _localizationService               = localizationService;
     _localizedModelFactory             = localizedModelFactory;
     _storeMappingSupportedModelFactory = storeMappingSupportedModelFactory;
     _topicService     = topicService;
     _urlHelperFactory = urlHelperFactory;
     _urlRecordService = urlRecordService;
     _webHelper        = webHelper;
 }
 public ItemDeleteTagHelper(IActionContextAccessor contextAccessor, IUrlHelperFactory urlHelperFactory)
     : base(contextAccessor, urlHelperFactory)
 {
 }
 private readonly IActionContextAccessor _accessor;     // for getting teamId from RouteData
 public TeamMemberHandler(IActionContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 37
0
        private void EnsureServices(HttpContext context)
        {
            if (_actionContextAccessor == null)
            {
                _actionContextAccessor = context.RequestServices.GetRequiredService<IActionContextAccessor>();
            }

            if (_actionInvokerFactory == null)
            {
                _actionInvokerFactory = context.RequestServices.GetRequiredService<IActionInvokerFactory>();
            }

            if (_actionSelector == null)
            {
                _actionSelector = context.RequestServices.GetRequiredService<IActionSelector>();
            }

            if (_logger == null)
            {
                var factory = context.RequestServices.GetRequiredService<ILoggerFactory>();
                _logger = factory.CreateLogger<MvcRouteHandler>();
            }
            
            if (_diagnosticSource == null)
            {
                _diagnosticSource = context.RequestServices.GetRequiredService<DiagnosticSource>();
            }
        }
 public PaginationTagHelper(IActionContextAccessor actionContextAccessor) {
     CurrentUrl = actionContextAccessor.ActionContext.HttpContext.Request.GetDisplayUrl();
 }
 public ActionContextController(IActionContextAccessor actionContextAccessor)
 {
     this.Context = actionContextAccessor.ActionContext;
 }
 public PaginationHelper(IUrlHelperFactory urlHelperFactory, IActionContextAccessor accessor)
 {
     UrlHelperFactory = urlHelperFactory;
     Accessor         = accessor;
 }
Exemplo n.º 41
0
 public CommonModelFactory(AdminAreaSettings adminAreaSettings,
                           CatalogSettings catalogSettings,
                           CurrencySettings currencySettings,
                           IActionContextAccessor actionContextAccessor,
                           IAuthenticationPluginManager authenticationPluginManager,
                           ICurrencyService currencyService,
                           ICustomerService customerService,
                           IDateTimeHelper dateTimeHelper,
                           INopFileProvider fileProvider,
                           IExchangeRatePluginManager exchangeRatePluginManager,
                           IHttpContextAccessor httpContextAccessor,
                           ILanguageService languageService,
                           ILocalizationService localizationService,
                           IMaintenanceService maintenanceService,
                           IMeasureService measureService,
                           IOrderService orderService,
                           IPaymentPluginManager paymentPluginManager,
                           IPickupPluginManager pickupPluginManager,
                           IPluginService pluginService,
                           IProductService productService,
                           IReturnRequestService returnRequestService,
                           ISearchTermService searchTermService,
                           IShippingPluginManager shippingPluginManager,
                           IStaticCacheManager cacheManager,
                           IStoreContext storeContext,
                           IStoreService storeService,
                           ITaxPluginManager taxPluginManager,
                           IUrlHelperFactory urlHelperFactory,
                           IUrlRecordService urlRecordService,
                           IWebHelper webHelper,
                           IWidgetPluginManager widgetPluginManager,
                           IWorkContext workContext,
                           MeasureSettings measureSettings,
                           NopConfig nopConfig,
                           NopHttpClient nopHttpClient,
                           ProxySettings proxySettings)
 {
     _adminAreaSettings           = adminAreaSettings;
     _catalogSettings             = catalogSettings;
     _currencySettings            = currencySettings;
     _actionContextAccessor       = actionContextAccessor;
     _authenticationPluginManager = authenticationPluginManager;
     _currencyService             = currencyService;
     _customerService             = customerService;
     _dateTimeHelper            = dateTimeHelper;
     _exchangeRatePluginManager = exchangeRatePluginManager;
     _httpContextAccessor       = httpContextAccessor;
     _languageService           = languageService;
     _localizationService       = localizationService;
     _maintenanceService        = maintenanceService;
     _measureService            = measureService;
     _fileProvider          = fileProvider;
     _orderService          = orderService;
     _paymentPluginManager  = paymentPluginManager;
     _pickupPluginManager   = pickupPluginManager;
     _pluginService         = pluginService;
     _productService        = productService;
     _returnRequestService  = returnRequestService;
     _searchTermService     = searchTermService;
     _shippingPluginManager = shippingPluginManager;
     _cacheManager          = cacheManager;
     _storeContext          = storeContext;
     _storeService          = storeService;
     _taxPluginManager      = taxPluginManager;
     _urlHelperFactory      = urlHelperFactory;
     _urlRecordService      = urlRecordService;
     _webHelper             = webHelper;
     _widgetPluginManager   = widgetPluginManager;
     _workContext           = workContext;
     _measureSettings       = measureSettings;
     _nopConfig             = nopConfig;
     _nopHttpClient         = nopHttpClient;
     _proxySettings         = proxySettings;
 }
Exemplo n.º 42
0
        private void EnsureServices(HttpContext context)
        {
            if (_servicesRetrieved)
            {
                return;
            }

            var services = context.RequestServices;

            // Verify if AddMvc was done before calling UseMvc
            // We use the MvcMarkerService to make sure if all the services were added.
            MvcServicesHelper.ThrowIfMvcNotRegistered(services);

            // The IActionContextAccessor is optional. We want to avoid the overhead of using CallContext
            // if possible.
            _actionContextAccessor = services.GetService<IActionContextAccessor>();

            _actionInvokerFactory = services.GetRequiredService<IActionInvokerFactory>();
            _actionSelector = services.GetRequiredService<IActionSelector>();
            _diagnosticSource = services.GetRequiredService<DiagnosticSource>();

            var factory = services.GetRequiredService<ILoggerFactory>();
            _logger = factory.CreateLogger<MvcRouteHandler>();

            _servicesRetrieved = true;
        }
 public AccessorComponent(IActionContextAccessor accessor)
 {
     this.ActionContext = accessor.ActionContext as ViewContext;
 }
Exemplo n.º 44
0
 /// <summary>
 /// Initialises a new instance of the <see cref="HrefGenerator"/> class.
 /// </summary>
 /// <param name="urlHelperFactory">URL helper factory</param>
 /// <param name="actionContextAccessor">Action context accessor</param>
 public HrefGenerator(IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccessor)
 {
     this.urlHelperFactory      = urlHelperFactory;
     this.actionContextAccessor = actionContextAccessor;
 }
Exemplo n.º 45
0
 public SeedLinkHelper([NotNull] IHttpContextAccessor httpContextAccessor, IActionContextAccessor actionContextAccessor, IUrlHelperFactory urlHelperFactory)
     : base(httpContextAccessor, actionContextAccessor, urlHelperFactory)
 {
 }
Exemplo n.º 46
0
 public DummyService(IActionContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 47
0
        public EnrichWithSchemaIdCommandMiddleware(IAppProvider appProvider, IActionContextAccessor actionContextAccessor)
        {
            this.appProvider = appProvider;

            this.actionContextAccessor = actionContextAccessor;
        }
Exemplo n.º 48
0
 protected CarLinkTagHelperBase(IActionContextAccessor contextAccessor, IUrlHelperFactory urlHelperFactory)
 {
     UrlHelper = urlHelperFactory.GetUrlHelper(contextAccessor.ActionContext);
 }
Exemplo n.º 49
0
        public UrlGenerator(IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccessor, IHttpContextAccessor httpContextAccessor)
        {
            _urlHelper = urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext);

            _httpContextAccessor = httpContextAccessor;
        }
 public SeedLinkHelper([NotNull] IHttpContextAccessor httpContextAccessor, IActionContextAccessor actionContextAccessor, IUrlHelperFactory urlHelperFactory)
     : base(httpContextAccessor, actionContextAccessor, urlHelperFactory)
 {
 }
Exemplo n.º 51
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ViewRenderer" /> class.
 /// </summary>
 /// <param name="serviceProvider">The service provider.</param>
 /// <param name="httpContextAccessor">The HTTP context accessor.</param>
 /// <param name="actionContextAccessor">The action context accessor.</param>
 /// <param name="tempDataProvider">The temporary data provider.</param>
 /// <param name="viewEngine">The view engine.</param>
 public ViewRenderer(IServiceProvider serviceProvider, IHttpContextAccessor httpContextAccessor, IActionContextAccessor actionContextAccessor, ITempDataProvider tempDataProvider, ICompositeViewEngine viewEngine)
 {
     this.serviceProvider       = serviceProvider;
     this.httpContextAccessor   = httpContextAccessor;
     this.actionContextAccessor = actionContextAccessor;
     this.tempDataProvider      = tempDataProvider;
     this.viewEngine            = viewEngine;
 }
Exemplo n.º 52
0
 private static UrlHelper CreateUrlHelper(IActionContextAccessor contextAccessor)
 {
     var actionSelector = new Mock<IActionSelector>(MockBehavior.Strict);
     return new UrlHelper(contextAccessor, actionSelector.Object);
 }
Exemplo n.º 53
0
 public CompositeFileModel(IHasher hasher, IUrlManager urlManager, IActionContextAccessor accessor)
     : base("file", urlManager, accessor)
 {
     //Creates a single hash of the full url (which can include many files)
     _fileSetKey = hasher.Hash(string.Join(".", ParsedPath.Names));
 }
Exemplo n.º 54
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UrlHelper"/> class using the specified action context and
 /// action selector.
 /// </summary>
 /// <param name="actionContextAccessor">The <see cref="IActionContextAccessor"/> to access the action context
 /// of the current request.</param>
 /// <param name="actionSelector">The <see cref="IActionSelector"/> to be used for verifying the correctness of
 /// supplied parameters for a route.
 /// </param>
 public UrlHelper(IActionContextAccessor actionContextAccessor, IActionSelector actionSelector)
 {
     _actionContextAccessor = actionContextAccessor;
     _actionSelector = actionSelector;
 }
Exemplo n.º 55
0
 public SirenEntityHto(
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccessor) : base(urlHelperFactory, actionContextAccessor)
 {
 }
 public RouteRequestCultureProvider(IActionContextAccessor actionContextAccessor, string RouteField = "lang")
 {
     this.RouteField = RouteField;
     ActionContext = actionContextAccessor.ActionContext;
 }