public UserStoreStub(ISecurity platformSecurityApi, IMemberService memberService, IStorefrontMemoryCache memoryCache, IOptions <StorefrontOptions> options)
 {
     _platformSecurityApi = platformSecurityApi;
     _memoryCache         = memoryCache;
     _memberService       = memberService;
     _options             = options.Value;
 }
 public StorefrontMemoryCache(IMemoryCache memoryCache, IOptions <StorefrontOptions> storefrontOptions, ILoggerFactory loggerFactory, IWorkContextAccessor workContextAccessor)
 {
     _workContextAccessor = workContextAccessor;
     _memoryCache         = memoryCache;
     _storefrontOptions   = storefrontOptions.Value;
     _log = loggerFactory?.CreateLogger <StorefrontMemoryCache>();
 }
 public SubscriptionService(ISubscriptionModule subscriptionApi, IWorkContextAccessor workContextAccessor, IStorefrontMemoryCache memoryCache, IOptions <StorefrontOptions> options)
 {
     _subscriptionApi     = subscriptionApi;
     _workContextAccessor = workContextAccessor;
     _memoryCache         = memoryCache;
     _options             = options.Value;
 }
 public WorkContextBuildMiddleware(RequestDelegate next, IHostingEnvironment hostingEnvironment,
                                   IOptions <StorefrontOptions> options, IWorkContextAccessor workContextAccessor)
 {
     _next = next;
     _hostingEnvironment  = hostingEnvironment;
     _workContextAccessor = workContextAccessor;
     _options             = options.Value;
 }
 public AccountController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, SignInManager <User> signInManager,
                          IEventPublisher publisher, INotifications platformNotificationApi, IOptions <StorefrontOptions> options)
     : base(workContextAccessor, urlBuilder)
 {
     _signInManager           = signInManager;
     _publisher               = publisher;
     _options                 = options.Value;
     _platformNotificationApi = platformNotificationApi;
 }
Beispiel #6
0
 public StoreService(IStoreModule storeApi, IStorefrontMemoryCache memoryCache, IApiChangesWatcher apiChangesWatcher, IPaymentModule paymentModule, ITaxModule taxModule, IOptions <StorefrontOptions> storefrontOptions)
 {
     _storeApi          = storeApi;
     _memoryCache       = memoryCache;
     _apiChangesWatcher = apiChangesWatcher;
     _paymentModule     = paymentModule;
     _taxModule         = taxModule;
     _storefrontOptions = storefrontOptions.Value;
 }
Beispiel #7
0
 public AccountController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, SignInManager <User> signInManager,
                          IEventPublisher publisher, IStorefrontSecurity commerceCoreApi, IOptions <StorefrontOptions> options)
     : base(workContextAccessor, urlBuilder)
 {
     _signInManager   = signInManager;
     _publisher       = publisher;
     _commerceCoreApi = commerceCoreApi;
     _urlBuilder      = urlBuilder;
     _options         = options.Value;
 }
        public WorkContextBuildMiddleware(RequestDelegate next, IWebHostEnvironment hostingEnvironment,
                                          IOptions <StorefrontOptions> options, IWorkContextAccessor workContextAccessor, IConfiguration configuration)
        {
            _next = next;
            _hostingEnvironment  = hostingEnvironment;
            _workContextAccessor = workContextAccessor;
            _options             = options.Value;
            _configuration       = configuration;

            //Load a user-defined  settings from the special section.
            //All of these settings are accessible from the themes and through access to WorkContext.ApplicationSettings property
            //Trim of the VirtoCommerce:AppSettings added for backward compatibility with old themes
            _applicationSettings = _configuration.GetSection("VirtoCommerce:AppSettings").AsEnumerable().Where(x => x.Value != null)
                                   .ToDictionary(x => x.Key.Replace("VirtoCommerce:AppSettings:", ""), x => (object)x.Value);
        }
        public RedisStorefrontMemoryCache(IMemoryCache memoryCache
                                          , IOptions <StorefrontOptions> cachingOptions
                                          , IOptions <RedisCachingOptions> redisCachingOptions
                                          , IWorkContextAccessor workContextAccessor
                                          , ILoggerFactory loggerFactory
                                          ) : base(memoryCache, cachingOptions, loggerFactory, workContextAccessor)
        {
            _connection = ConnectionMultiplexer.Connect(redisCachingOptions.Value.Configuration);
            _log        = loggerFactory?.CreateLogger <RedisStorefrontMemoryCache>();
            _bus        = _connection.GetSubscriber();

            _redisCachingOptions = redisCachingOptions.Value;
            _storefrontOptions   = cachingOptions.Value;

            CacheCancellableTokensRegistry.OnTokenCancelled = CacheCancellableTokensRegistry_OnTokenCancelled;
        }
        public WorkContextBuilder(HttpContext httpContext, StorefrontOptions options)
        {
            HttpContext = httpContext;
            WorkContext = new WorkContext();

            WorkContext.RequestUrl = HttpContext.Request.GetUri();
            var htmlEncoder = httpContext.RequestServices.GetRequiredService <HtmlEncoder>();
            var qs          = WorkContext.QueryString = HttpContext.Request.Query.ToNameValueCollection(htmlEncoder);

            WorkContext.PageNumber = qs["page"].ToNullableInt();

            var qsPageSize = qs["count"].ToNullableInt() ?? qs["page_size"].ToNullableInt();

            if (qsPageSize.HasValue && qsPageSize.Value > options.PageSizeMaxValue)
            {
                WorkContext.PageSize = options.PageSizeMaxValue;
            }
        }
        public RedisStorefrontMemoryCache(IMemoryCache memoryCache
                                          , IOptions <StorefrontOptions> cachingOptions
                                          , IOptions <RedisCachingOptions> redisCachingOptions
                                          , IWorkContextAccessor workContextAccessor
                                          , ILoggerFactory loggerFactory
                                          ) : base(memoryCache, cachingOptions, loggerFactory, workContextAccessor)
        {
            _connection = ConnectionMultiplexer.Connect(redisCachingOptions.Value.Configuration);

            _redisCachingOptions = redisCachingOptions.Value;
            _storefrontOptions   = cachingOptions.Value;

            _connection.ConnectionFailed   += OnConnectionFailed;
            _connection.ConnectionRestored += OnConnectionRestored;

            _bus = _connection.GetSubscriber();
            _bus.Subscribe(_redisCachingOptions.ChannelName, OnMessage, CommandFlags.FireAndForget);
        }
 public AccountController(
     IWorkContextAccessor workContextAccessor,
     IStorefrontUrlBuilder urlBuilder,
     SignInManager <User> signInManager,
     IEventPublisher publisher,
     INotifications platformNotificationApi,
     IAuthorizationService authorizationService,
     IOptions <StorefrontOptions> options,
     IOptions <IdentityOptions> identityOptions)
     : base(workContextAccessor, urlBuilder)
 {
     _urlBuilder              = urlBuilder;
     _signInManager           = signInManager;
     _publisher               = publisher;
     _options                 = options.Value;
     _platformNotificationApi = platformNotificationApi;
     _authorizationService    = authorizationService;
     _identityOptions         = identityOptions.Value;
 }
        public WorkContextBuilder(HttpContext httpContext, StorefrontOptions options)
        {
            HttpContext = httpContext;

            var qs = HttpContext.Request.Query.ToNameValueCollection();

            WorkContext = new WorkContext
            {
                RequestUrl  = HttpContext.Request.GetUri(),
                QueryString = qs,
                PageNumber  = qs["page"].ToNullableInt(),
            };

            var pageSize = qs["count"].ToNullableInt() ?? qs["page_size"].ToNullableInt();

            if (pageSize != null && pageSize.Value > options.PageSizeMaxValue)
            {
                pageSize = options.PageSizeMaxValue;
            }
            WorkContext.PageSize = pageSize;
            //To interpret as true the value of preview_mode from the query string according to its actual presence, since another value of this parameter can be passed.
            WorkContext.IsPreviewMode = !string.IsNullOrEmpty(WorkContext.QueryString.Get("preview_mode"));
        }
Beispiel #14
0
 public StorefrontMemoryCache(IMemoryCache memoryCache, IOptions <StorefrontOptions> storefrontOptions, ILoggerFactory loggerFactory)
 {
     _memoryCache       = memoryCache;
     _storefrontOptions = storefrontOptions.Value;
     _log = loggerFactory?.CreateLogger <StorefrontMemoryCache>();
 }
 public StorefrontMemoryCache(IMemoryCache memoryCache, IOptions <StorefrontOptions> storefrontOptions, ILogger <StorefrontMemoryCache> log)
 {
     _memoryCache       = memoryCache;
     _storefrontOptions = storefrontOptions.Value;
     _log = log;
 }
Beispiel #16
0
 public PromotionEvaluator(IMarketingModulePromotion promiotionApi, IStorefrontMemoryCache memoryCache, IOptions <StorefrontOptions> storefrontOptions)
 {
     _promiotionApi     = promiotionApi;
     _memoryCache       = memoryCache;
     _storefrontOptions = storefrontOptions.Value;
 }
 public StorefrontMemoryCache(IMemoryCache memoryCache, IOptions <StorefrontOptions> storefrontOptions)
 {
     _memoryCache       = memoryCache;
     _storefrontOptions = storefrontOptions.Value;
 }