/// <summary>
        /// Initializes a new instance of the <see cref="MerchelloPetaPocoRepositoryBase{TEntity}"/> class.
        /// </summary>
        /// <param name="work">
        /// The work.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="sqlSyntax">
        /// The SQL Syntax.
        /// </param>
        protected MerchelloPetaPocoRepositoryBase(IDatabaseUnitOfWork work, IRuntimeCacheProvider cache, ILogger logger, ISqlSyntaxProvider sqlSyntax)
            : base(work, cache, logger)
        {
            Mandate.ParameterNotNull(sqlSyntax, "sqlSyntax");

            _sqlSyntax = sqlSyntax;
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance based on the provided providers
 /// </summary>
 /// <param name="httpCacheProvider"></param>
 /// <param name="staticCacheProvider"></param>
 /// <param name="requestCacheProvider"></param>
 public CacheHelper(
     IRuntimeCacheProvider httpCacheProvider,
     ICacheProvider staticCacheProvider,
     ICacheProvider requestCacheProvider)
     : this(httpCacheProvider, staticCacheProvider, requestCacheProvider, true)
 {
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedRateTaxationGatewayProvider"/> class.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The gateway provider service.
 /// </param>
 /// <param name="gatewayProviderSettings">
 /// The gateway provider settings.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 public FixedRateTaxationGatewayProvider(
     IGatewayProviderService gatewayProviderService,
     IGatewayProviderSettings gatewayProviderSettings,
     IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {
 }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomerRepository"/> class.
        /// </summary>
        /// <param name="work">
        /// The database unit of work
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <param name="customerAddressRepository">
        /// The customer Address Repository.
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="sqlSyntax">
        /// The SQL Syntax.
        /// </param>
        public CustomerRepository(IDatabaseUnitOfWork work, IRuntimeCacheProvider cache, ICustomerAddressRepository customerAddressRepository, ILogger logger, ISqlSyntaxProvider sqlSyntax)
            : base(work, cache, logger, sqlSyntax)
        {
            Mandate.ParameterNotNull(customerAddressRepository, "customerAddressRepository");

            _customerAddressRepository = customerAddressRepository;
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultShipmentRateQuoteStrategy"/> class.
 /// </summary>
 /// <param name="shipment">
 /// The shipment.
 /// </param>
 /// <param name="shippingGatewayMethods">
 /// The shipping gateway methods.
 /// </param>
 /// <param name="runtimeCache">
 /// The runtime cache.
 /// </param>
 public DefaultShipmentRateQuoteStrategy(
     IShipment shipment,
     IShippingGatewayMethod[] shippingGatewayMethods,
     IRuntimeCacheProvider runtimeCache)
     : base(shipment, shippingGatewayMethods, runtimeCache)
 {
 }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OrderRepository"/> class.
        /// </summary>
        /// <param name="work">
        /// The work.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <param name="orderLineItemRepository">
        /// The order line item repository.
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="sqlSyntax">
        /// The SQL syntax.
        /// </param>
        public OrderRepository(IDatabaseUnitOfWork work, IRuntimeCacheProvider cache, ILineItemRepositoryBase <IOrderLineItem> orderLineItemRepository, ILogger logger, ISqlSyntaxProvider sqlSyntax)
            : base(work, cache, logger, sqlSyntax)
        {
            Mandate.ParameterNotNull(orderLineItemRepository, "lineItemRepository");

            _orderLineItemRepository = orderLineItemRepository;
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TypeLoader"/> class.
        /// </summary>
        /// <param name="runtimeCache">The application runtime cache.</param>
        /// <param name="localTempStorage">Files storage mode.</param>
        /// <param name="logger">A profiling logger.</param>
        /// <param name="detectChanges">Whether to detect changes using hashes.</param>
        internal TypeLoader(IRuntimeCacheProvider runtimeCache, LocalTempStorage localTempStorage, IProfilingLogger logger, bool detectChanges)
        {
            _runtimeCache     = runtimeCache ?? throw new ArgumentNullException(nameof(runtimeCache));
            _localTempStorage = localTempStorage == LocalTempStorage.Unknown ? LocalTempStorage.Default : localTempStorage;
            _logger           = logger ?? throw new ArgumentNullException(nameof(logger));

            if (detectChanges)
            {
                //first check if the cached hash is string.Empty, if it is then we need
                //do the check if they've changed
                RequiresRescanning = CachedAssembliesHash != CurrentAssembliesHash || CachedAssembliesHash == string.Empty;
                //if they have changed, we need to write the new file
                if (RequiresRescanning)
                {
                    // if the hash has changed, clear out the persisted list no matter what, this will force
                    // rescanning of all types including lazy ones.
                    // http://issues.umbraco.org/issue/U4-4789
                    var typesListFilePath = GetTypesListFilePath();
                    DeleteFile(typesListFilePath, FileDeleteTimeout);

                    WriteCacheTypesHash();
                }
            }
            else
            {
                // if the hash has changed, clear out the persisted list no matter what, this will force
                // rescanning of all types including lazy ones.
                // http://issues.umbraco.org/issue/U4-4789
                var typesListFilePath = GetTypesListFilePath();
                DeleteFile(typesListFilePath, FileDeleteTimeout);

                // always set to true if we're not detecting (generally only for testing)
                RequiresRescanning = true;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TaxationGatewayProviderBase"/> class.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The gateway provider service.
 /// </param>
 /// <param name="gatewayProviderSettings">
 /// The gateway provider settings.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 protected TaxationGatewayProviderBase(
     IGatewayProviderService gatewayProviderService,
     IGatewayProviderSettings gatewayProviderSettings, 
     IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {            
 }
示例#9
0
 /// <summary>
 /// Initializes a new instance based on the provided providers
 /// </summary>
 /// <param name="httpCacheProvider"></param>
 /// <param name="staticCacheProvider"></param>
 /// <param name="requestCacheProvider"></param>
 /// <param name="isolatedCacheManager"></param>
 public CacheHelper(
     IRuntimeCacheProvider httpCacheProvider,
     ICacheProvider staticCacheProvider,
     ICacheProvider requestCacheProvider,
     IsolatedRuntimeCache isolatedCacheManager)
 {
     if (httpCacheProvider == null)
     {
         throw new ArgumentNullException("httpCacheProvider");
     }
     if (staticCacheProvider == null)
     {
         throw new ArgumentNullException("staticCacheProvider");
     }
     if (requestCacheProvider == null)
     {
         throw new ArgumentNullException("requestCacheProvider");
     }
     if (isolatedCacheManager == null)
     {
         throw new ArgumentNullException("isolatedCacheManager");
     }
     RuntimeCache         = httpCacheProvider;
     StaticCache          = staticCacheProvider;
     RequestCache         = requestCacheProvider;
     IsolatedRuntimeCache = isolatedCacheManager;
 }
示例#10
0
 public static CacheHelper GetCacheHelper(IRuntimeCacheProvider httpCache = null, ICacheProvider staticCache = null, ICacheProvider requestCache = null, IsolatedRuntimeCache isolastedRuntime = null)
 {
     return(new CacheHelper(httpCache ?? Mock.Of <IRuntimeCacheProvider>(),
                            staticCache ?? Mock.Of <ICacheProvider>(),
                            requestCache ?? Mock.Of <ICacheProvider>(),
                            isolastedRuntime ?? GetIsolatedRuntimeCache()));
 }
示例#11
0
 public CacheHelper(
     IRuntimeCacheProvider httpCacheProvider,
     ICacheProvider staticCacheProvider,
     ICacheProvider requestCacheProvider)
     : this(httpCacheProvider, staticCacheProvider, requestCacheProvider, new IsolatedRuntimeCache(t => new ObjectCacheRuntimeCacheProvider()))
 {
 }
示例#12
0
 public SmtpNotificationGatewayProvider(
     IGatewayProviderService gatewayProviderService,
     IGatewayProviderSettings gatewayProviderSettings,
     IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {
 }
 public GridEditorsConfig(ILogger logger, IRuntimeCacheProvider runtimeCache, DirectoryInfo configFolder, bool isDebug)
 {
     _logger       = logger;
     _runtimeCache = runtimeCache;
     _configFolder = configFolder;
     _isDebug      = isDebug;
 }
示例#14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WarehouseRepository"/> class.
        /// </summary>
        /// <param name="work">
        /// The work.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <param name="warehouseCatalogRepository">
        /// The warehouse Catalog Repository.
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="sqlSyntax">
        /// The SQL Syntax.
        /// </param>
        public WarehouseRepository(IDatabaseUnitOfWork work, IRuntimeCacheProvider cache, IWarehouseCatalogRepository warehouseCatalogRepository, ILogger logger, ISqlSyntaxProvider sqlSyntax)
            : base(work, cache, logger, sqlSyntax)
        {
            Mandate.ParameterNotNull(warehouseCatalogRepository, "warehouseCatalogRepository");

            _warehouseCatalogRepository = warehouseCatalogRepository;
        }
示例#15
0
        /// <summary>
        /// States whether an Url is handled by Umbraco
        /// </summary>
        /// <param name="umbracoUrl">The umbraco url object from the app's config</param>
        /// <returns>Url is an Ubraco Url</returns>
        public bool IsUmbracoUrl(UmbracoUrl umbracoUrl)
        {
            if (string.IsNullOrEmpty(umbracoUrl.Value))
            {
                LogHelper.Error <UmbracoUrlService>("Error: No Unauthorized URL set in configuration", null);
                return(false);
            }

            if (umbracoUrl.Type == UmbracoUrlTypes.XPath || umbracoUrl.Type == UmbracoUrlTypes.ContentPicker)
            {
                return(true);
            }
            if (cache == null)
            {
                cache = ApplicationContext.Current.ApplicationCache.RuntimeCache;
            }

            return(cache.GetCacheItem <bool>(CacheKeyIsUmbracoUrl + umbracoUrl.Value, () =>
            {
                EnsureUmbracoContext(HttpContext.Current);
                var umbContext = UmbracoContext.Current;

                return umbContext.ContentCache.GetByRoute(umbracoUrl.Value) != null;
            }, CacheDuration));
        }
        /// <summary>
        /// Returns the enumerable of all extension method info's in the app domain = USE SPARINGLY!!!
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        /// We cache this as a sliding 5 minute exiration, in unit tests there's over 1100 methods found, surely that will eat up a bit of memory so we want
        /// to make sure we give it back.
        /// </remarks>
        private static IEnumerable <MethodInfo> GetAllExtensionMethodsInAppDomain(IRuntimeCacheProvider runtimeCacheProvider)
        {
            if (runtimeCacheProvider == null)
            {
                throw new ArgumentNullException("runtimeCacheProvider");
            }

            return(runtimeCacheProvider.GetCacheItem <MethodInfo[]>(typeof(ExtensionMethodFinder).Name, () => TypeFinder.GetAssembliesWithKnownExclusions()
                                                                    // assemblies that contain extension methods
                                                                    .Where(a => a.IsDefined(typeof(ExtensionAttribute), false))
                                                                    // types that contain extension methods
                                                                    .SelectMany(a => a.GetTypes()
                                                                                .Where(t => t.IsDefined(typeof(ExtensionAttribute), false) && t.IsSealed && t.IsGenericType == false && t.IsNested == false))
                                                                    // actual extension methods
                                                                    .SelectMany(t => t.GetMethods(BindingFlags.Static | BindingFlags.Public)
                                                                                .Where(m => m.IsDefined(typeof(ExtensionAttribute), false)))
                                                                    // and also IEnumerable<T> extension methods - because the assembly is excluded
                                                                    .Concat(typeof(Enumerable).GetMethods(BindingFlags.Static | BindingFlags.Public))
                                                                    //If we don't do this then we'll be scanning all assemblies each time!
                                                                    .ToArray(),

                                                                    //only cache for 5 minutes
                                                                    timeout: TimeSpan.FromMinutes(5),

                                                                    //each time this is accessed it will be for 5 minutes longer
                                                                    isSliding: true));
        }
示例#17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CashPaymentGatewayProvider"/> class.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The gateway provider service.
 /// </param>
 /// <param name="gatewayProviderSettings">
 /// The gateway provider settings.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 public CashPaymentGatewayProvider(
     IGatewayProviderService gatewayProviderService,
     IGatewayProviderSettings gatewayProviderSettings,
     IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {
 }
示例#18
0
 internal static void EnsureContext(
     ILogger logger,
     IRuntimeCacheProvider runtimeCacheProvider
     )
 {
     Current = new UserContentContext(logger, runtimeCacheProvider);
 }
 internal PermissionRepository(IScopeUnitOfWork unitOfWork, CacheHelper cache, ISqlSyntaxProvider sqlSyntax)
 {
     _unitOfWork = unitOfWork;
     //Make this repository use an isolated cache
     _runtimeCache = cache.IsolatedRuntimeCache.GetOrCreateCache <EntityPermission>();
     _sqlSyntax    = sqlSyntax;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultShipmentRateQuoteStrategy"/> class.
 /// </summary>
 /// <param name="shipment">
 /// The shipment.
 /// </param>
 /// <param name="shippingGatewayMethods">
 /// The shipping gateway methods.
 /// </param>
 /// <param name="runtimeCache">
 /// The runtime cache.
 /// </param>
 public DefaultShipmentRateQuoteStrategy(
     IShipment shipment,
     IShippingGatewayMethod[] shippingGatewayMethods,
     IRuntimeCacheProvider runtimeCache)
     : base(shipment, shippingGatewayMethods, runtimeCache)
 {
 }
示例#21
0
        public OrderRepository(IDatabaseUnitOfWork work, IRuntimeCacheProvider cache, ILineItemRepositoryBase <IOrderLineItem> orderLineItemRepository)
            : base(work, cache)
        {
            Mandate.ParameterNotNull(orderLineItemRepository, "lineItemRepository");

            _orderLineItemRepository = orderLineItemRepository;
        }
示例#22
0
 public FedExShippingGatewayProvider(IGatewayProviderService gatewayProviderService,
                                     IGatewayProviderSettings gatewayProvider, IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProvider, runtimeCacheProvider)
 {
     _settings     = new FedExProcessorSettings();
     _runtimeCache = runtimeCacheProvider;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CashPaymentGatewayProvider"/> class.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The gateway provider service.
 /// </param>
 /// <param name="gatewayProviderSettings">
 /// The gateway provider settings.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 public CashPaymentGatewayProvider(
     IGatewayProviderService gatewayProviderService,
     IGatewayProviderSettings gatewayProviderSettings,
     IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {
 }
示例#24
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            ContentService.Published   += ContentService_PublishEvent;
            ContentService.UnPublished += ContentService_PublishEvent;

            _runtimeCache = applicationContext.ApplicationCache.RuntimeCache;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ShipCountryRepository"/> class.
        /// </summary>
        /// <param name="work">
        /// The work.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <param name="storeSettingService">
        /// The store setting service.
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="sqlSyntax">
        /// The SQL syntax.
        /// </param>
        public ShipCountryRepository(IDatabaseUnitOfWork work, IRuntimeCacheProvider cache, IStoreSettingService storeSettingService, ILogger logger, ISqlSyntaxProvider sqlSyntax)
            : base(work, cache, logger, sqlSyntax)
        {
            Mandate.ParameterNotNull(storeSettingService, "settingsService");

            _storeSettingService = storeSettingService;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PaymentGatewayProviderBase"/> class.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The gateway provider service.
 /// </param>
 /// <param name="gatewayProviderSettings">
 /// The gateway provider settings.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 protected PaymentGatewayProviderBase(
     IGatewayProviderService gatewayProviderService,
     IGatewayProviderSettings gatewayProviderSettings,
     IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedRateTaxationGatewayProvider"/> class.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The gateway provider service.
 /// </param>
 /// <param name="gatewayProviderSettings">
 /// The gateway provider settings.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 public FixedRateTaxationGatewayProvider(
     IGatewayProviderService gatewayProviderService,
     IGatewayProviderSettings gatewayProviderSettings,
     IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {
 }
 public FedExShippingGatewayProvider(IGatewayProviderService gatewayProviderService,
     IGatewayProviderSettings gatewayProvider, IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProvider, runtimeCacheProvider)
 {
     _settings = new FedExProcessorSettings();
     _runtimeCache = runtimeCacheProvider;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomerRepository"/> class.
        /// </summary>
        /// <param name="work">
        /// The database unit of work
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <param name="customerAddressRepository">
        /// The customer Address Repository.
        /// </param>
        public CustomerRepository(IDatabaseUnitOfWork work, IRuntimeCacheProvider cache, ICustomerAddressRepository customerAddressRepository)
            : base(work, cache)
        {
            Mandate.ParameterNotNull(customerAddressRepository, "customerAddressRepository");

            _customerAddressRepository = customerAddressRepository;
        }
示例#30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WarehouseRepository"/> class.
        /// </summary>
        /// <param name="work">
        /// The work.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <param name="warehouseCatalogRepository">
        /// The warehouse Catalog Repository.
        /// </param>
        public WarehouseRepository(IDatabaseUnitOfWork work, IRuntimeCacheProvider cache, IWarehouseCatalogRepository warehouseCatalogRepository)
            : base(work, cache)
        {
            Mandate.ParameterNotNull(warehouseCatalogRepository, "warehouseCatalogRepository");

            _warehouseCatalogRepository = warehouseCatalogRepository;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShipRateTierRepository"/> class.
 /// </summary>
 /// <param name="work">
 /// The work.
 /// </param>
 /// <param name="cache">
 /// The cache.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="sqlSyntax">
 /// The SQL syntax.
 /// </param>
 public ShipRateTierRepository(
     IDatabaseUnitOfWork work,
     IRuntimeCacheProvider cache,
     ILogger logger,
     ISqlSyntaxProvider sqlSyntax)
     : base(work, cache, logger, sqlSyntax)
 {
 }
 public FedExShippingGatewayMethod(IGatewayResource gatewayResource, IShipMethod shipMethod, IShipCountry shipCountry, IGatewayProviderSettings gatewayProviderSettings, IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayResource, shipMethod, shipCountry)
 {
     _processor = new FedExShippingProcessor(gatewayProviderSettings.ExtendedData.GetProcessorSettings());
     _gatewayProviderSettings = gatewayProviderSettings;
     _shipMethod = shipMethod;
     _runtimeCache = runtimeCacheProvider;
 }
示例#33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GeocodeProviderBase"/> class.
        /// </summary>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Throws an <see cref="ArgumentNullException"/> if the cache parameter is omitted
        /// </exception>
        protected GeocodeProviderBase(IRuntimeCacheProvider cache)
        {
            if (cache == null) throw new ArgumentNullException("cache");

            _cache = cache;

            _settings = new GeocodeProviderSettings(GetType());
        }
示例#34
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MerchelloRepositoryBase{TEntity}"/> class.
        /// </summary>
        /// <param name="work">
        /// The unit of work.
        /// </param>
        /// <param name="cache">
        /// The runtime cache provider.
        /// </param>
        protected MerchelloRepositoryBase(IUnitOfWork work, IRuntimeCacheProvider cache)
        {
            Mandate.ParameterNotNull(work, "work");
            Mandate.ParameterNotNull(cache, "cache");

            _work  = work;
            _cache = cache;
        }
 protected RepositoryCachePolicyBase(IRuntimeCacheProvider cache)
 {
     if (cache == null)
     {
         throw new ArgumentNullException("cache");
     }
     Cache = cache;
 }
 public SmtpNotificationGatewayProvider(
     IGatewayProviderService gatewayProviderService,
     IGatewayProviderSettings gatewayProviderSettings,
     IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {
     
 }
示例#37
0
 public FedExShippingGatewayMethod(IGatewayResource gatewayResource, IShipMethod shipMethod, IShipCountry shipCountry, IGatewayProviderSettings gatewayProviderSettings, IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayResource, shipMethod, shipCountry)
 {
     _processor = new FedExShippingProcessor(gatewayProviderSettings.ExtendedData.GetProcessorSettings());
     _gatewayProviderSettings = gatewayProviderSettings;
     _shipMethod   = shipMethod;
     _runtimeCache = runtimeCacheProvider;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PrimedProductFilterGroupTree"/> class.
        /// </summary>
        /// <param name="merchelloContext">
        /// The merchello context.
        /// </param>
        /// <param name="getAll">
        /// A function to get all of the product filter groups.
        /// </param>
        internal PrimedProductFilterGroupTree(IMerchelloContext merchelloContext, Func<IEnumerable<IProductFilterGroup>> getAll)
        {
            Ensure.ParameterNotNull(merchelloContext, "merchelloContext");
            Ensure.ParameterNotNull(getAll, "getAll");

            _productService = merchelloContext.Services.ProductService;
            _getter = getAll;
            _cache = merchelloContext.Cache.RuntimeCache;
        }
示例#39
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepositoryFactory"/> class.
        /// </summary>
        /// <param name="database">
        /// The database.
        /// </param>
        /// <param name="runtimeCache">
        /// The runtimeCache.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Throws exception if either database or runtimeCache is null
        /// </exception>
        public RepositoryFactory(UmbracoDatabase database, IRuntimeCacheProvider runtimeCache)
        {
            if (database == null) throw new ArgumentNullException("database");
            if (runtimeCache == null) throw new ArgumentNullException("runtimeCache");

            this._runtimeCache = runtimeCache;

            _database = database;
        }
示例#40
0
 public ManifestParser(DirectoryInfo pluginsDir, IRuntimeCacheProvider cache)
 {
     if (pluginsDir == null)
     {
         throw new ArgumentNullException("pluginsDir");
     }
     _pluginsDir = pluginsDir;
     _cache      = cache;
 }
示例#41
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GatewayProviderBase"/> class.
        /// </summary>
        /// <param name="gatewayProviderService">The <see cref="IGatewayProviderService"/></param>
        /// <param name="gatewayProviderSettings">The <see cref="IGatewayProviderSettings"/></param>
        /// <param name="runtimeCacheProvider">Umbraco's <see cref="IRuntimeCacheProvider"/></param>
        protected GatewayProviderBase(IGatewayProviderService gatewayProviderService, IGatewayProviderSettings gatewayProviderSettings, IRuntimeCacheProvider runtimeCacheProvider)
        {
            Mandate.ParameterNotNull(gatewayProviderService, "gatewayProviderService");
            Mandate.ParameterNotNull(gatewayProviderSettings, "gatewayProvider");
            Mandate.ParameterNotNull(runtimeCacheProvider, "runtimeCacheProvider");

            _gatewayProviderService = gatewayProviderService;
            _gatewayProviderSettings = gatewayProviderSettings;
            _runtimeCache = runtimeCacheProvider;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ShipmentRateQuoteStrategyBase"/> class.
        /// </summary>
        /// <param name="shipment">
        /// The shipment.
        /// </param>
        /// <param name="shippingGatewayMethods">
        /// The shipping gateway methods.
        /// </param>
        /// <param name="runtimeCache">
        /// The runtime cache.
        /// </param>
        protected ShipmentRateQuoteStrategyBase(IShipment shipment, IShippingGatewayMethod[] shippingGatewayMethods, IRuntimeCacheProvider runtimeCache)
        {
            Mandate.ParameterNotNull(shipment, "shipment");
            Mandate.ParameterNotNull(shippingGatewayMethods, "gatewayShipMethods");
            Mandate.ParameterNotNull(runtimeCache, "runtimeCache");

            _shipment = shipment;
            _shippingGatewayMethods = shippingGatewayMethods;
            _runtimeCache = runtimeCache;
        }
示例#43
0
        public static JArray GetResult(IRuntimeCacheProvider cache, string url)
        {
            return (JArray)cache.GetCacheItem(url, () =>
            {
                using (var client = new HttpClient())
                {
                    var result = client.GetStringAsync(url);
                    Task.WaitAll(result);
                    return JsonConvert.DeserializeObject<JArray>(result.Result);
                }
            });

        }
        public UspsShippingGatewayMethod(IGatewayResource gatewayResource, IShipMethod shipMethod, IShipCountry shipCountry, IGatewayProviderSettings gatewayProviderSettings, IRuntimeCacheProvider runtimeCache) : 
            base(gatewayResource, shipMethod, shipCountry)
        {
            _processorSettings = gatewayProviderSettings.ExtendedData.GetProcessorSettings();
            _shipMethod = shipMethod;
            _runtimeCache = runtimeCache;
            _gatewayProviderSettings = gatewayProviderSettings;

            // Express Mail Hold For Pickup
            ServiceLookup[2] = new[] { new UspsDeliveryOption(2, Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue, 108, 70) };

            // Express Mail Flat-Rate Envelope Hold For Pickup
            ServiceLookup[27] = new[] { new UspsDeliveryOption(27, 12.5M, 9.5M, 0.75M, Decimal.MaxValue, 70) };

            // Express Mail
            ServiceLookup[3] = new[] { new UspsDeliveryOption(3, Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue, 108, 70) };

            // Express Mail Flat-Rate Envelope
            ServiceLookup[13] = new[] { new UspsDeliveryOption(13, 12.5M, 9.5M, 0.75M, Decimal.MaxValue, 70) };

            // Priority Mail
            ServiceLookup[1] = new[] { new UspsDeliveryOption(1, Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue, 108, 70) };

            // Priority Mail Flat-Rate Envelope
            ServiceLookup[16] = new[] { new UspsDeliveryOption(16, 12.5M, 9.5M, 0.75M, Decimal.MaxValue, 70) };

            // Priority Mail Small Flat-Rate Box
            ServiceLookup[28] = new[] { new UspsDeliveryOption(28, 5.375M, 8.625M, 1.675M, Decimal.MaxValue, 70) };

            // Priority Mail Regular/Medium Flat-Rate Boxes
            ServiceLookup[17] = new[]
                                    {
                                        new UspsDeliveryOption(17, 11.875M, 13.625M, 3.375M, Decimal.MaxValue, 70),
                                        new UspsDeliveryOption(17, 11M, 8.5M, 5.5M, Decimal.MaxValue, 70)
                                    };

            // Priority Mail Large Flat-Rate Box
            ServiceLookup[22] = new[] { new UspsDeliveryOption(22, 12, 12, 5.5M, Decimal.MaxValue, 70) };

            // Parcel Post
            ServiceLookup[4] = new[] { new UspsDeliveryOption(4, Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue, 108, 70) };

            // Bound Printed Matter
            ServiceLookup[5] = new[] { new UspsDeliveryOption(5, Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue, 108, 70) };

            // Media Mail
            ServiceLookup[6] = new[] { new UspsDeliveryOption(6, Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue, 108, 70) };

            // Library Mail
            ServiceLookup[7] = new[] { new UspsDeliveryOption(7, Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue, 108, 70) };
        }
示例#45
0
 /// <summary>
 /// The get ship rate table.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The gateway provider service.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 /// <param name="shipMethodKey">
 /// The ship method key.
 /// </param>
 /// <returns>
 /// The <see cref="ShippingFixedRateTable"/>.
 /// </returns>
 internal static ShippingFixedRateTable GetShipRateTable(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider runtimeCacheProvider, Guid shipMethodKey)
 {
     return (ShippingFixedRateTable) runtimeCacheProvider.GetCacheItem(
         CacheKeys.GatewayShipMethodCacheKey(shipMethodKey),
         delegate
             {
                 var rows = gatewayProviderService.GetShipRateTiersByShipMethodKey(shipMethodKey);
                 return new ShippingFixedRateTable(shipMethodKey, rows);
             });
 }
示例#46
0
        /// <summary>
        /// The save.
        /// </summary>
        /// <param name="gatewayProviderService">
        /// The gateway provider service.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <param name="rateTable">
        /// The rate table.
        /// </param>
        internal static void Save(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider cache, IShippingFixedRateTable rateTable)
        {
            // clear the current cached item
            // TODO : This should use the distributed cache referesher
            cache.ClearCacheItem(CacheKeys.GatewayShipMethodCacheKey(rateTable.ShipMethodKey));

            // persist and enter into cache
            gatewayProviderService.Save(rateTable.Rows);
            cache.GetCacheItem(CacheKeys.GatewayShipMethodCacheKey(rateTable.ShipMethodKey), () => rateTable);
        }
示例#47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RepositoryFactory"/> class.
 /// </summary>
 /// <param name="disableAllCache">
 /// The disable all cache.
 /// </param>
 /// <param name="nullCacheProvider">
 /// The null cache provider.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 public RepositoryFactory(bool disableAllCache, IRuntimeCacheProvider nullCacheProvider, IRuntimeCacheProvider runtimeCacheProvider)
     : this(disableAllCache, nullCacheProvider, runtimeCacheProvider, Logger.CreateWithDefaultLog4NetConfiguration(), ApplicationContext.Current.DatabaseContext.SqlSyntax)
 {
 }
示例#48
0
        /// <summary>
        /// The delete row.
        /// </summary>
        /// <param name="gatewayProviderService">
        /// The gateway provider service.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        /// <param name="rateTable">
        /// The rate table.
        /// </param>
        /// <param name="shipRateTier">
        /// The ship rate tier.
        /// </param>
        internal static void DeleteRow(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider cache, IShippingFixedRateTable rateTable, IShipRateTier shipRateTier)
        {
            var row = rateTable.Rows.FirstOrDefault(x => x.Key == shipRateTier.Key);
            if (!rateTable.Rows.Any() || row == null) return;

            if (rateTable.Rows.IndexOf(rateTable.Rows.Last()) != rateTable.Rows.IndexOf(row))
            {
                rateTable.Rows.First(x => x.RangeLow == row.RangeHigh).RangeLow = row.RangeLow;
            }

            // clear the current cached item
            // TODO : This should use the distributed cache referesher
            cache.ClearCacheItem(CacheKeys.GatewayShipMethodCacheKey(rateTable.ShipMethodKey));

            gatewayProviderService.Save(rateTable.Rows);
            gatewayProviderService.Delete(shipRateTier);

            cache.GetCacheItem(CacheKeys.GatewayShipMethodCacheKey(rateTable.ShipMethodKey), () => rateTable);
        }  
示例#49
0
        internal static void DeleteRow(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider cache, IUPSShippingRateTable rateTable, IShipRateTier shipRateTier)
        {
            //var row = Rows.FirstOrDefault(x => x.Key == shipRateTier.Key);
            //if (!Rows.Any() || row == null) return;
            //if (Rows.IndexOf(Rows.Last()) != Rows.IndexOf(row))
            //{
            //    _shipRateTiers[Rows.IndexOf(row) + 1].RangeLow = row.RangeLow;
            //}
            //_shipRateTiers.Remove(row);

            var row = rateTable.Rows.FirstOrDefault(x => x.Key == shipRateTier.Key);
            if (!rateTable.Rows.Any() || row == null) return;

            if (rateTable.Rows.IndexOf(rateTable.Rows.Last()) != rateTable.Rows.IndexOf(row))
            {
                rateTable.Rows.First(x => x.RangeLow == row.RangeHigh).RangeLow = row.RangeLow;
            }

            gatewayProviderService.Save(rateTable.Rows);
            gatewayProviderService.Delete(shipRateTier);
        }
 protected PaymentGatewayProviderBase(IGatewayProviderService gatewayProviderService, IGatewayProvider gatewayProvider, IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProvider, runtimeCacheProvider)
 {
 }
 public PayPalPaymentGatewayProvider(IGatewayProviderService gatewayProviderService, IGatewayProvider gatewayProvider, IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProvider, runtimeCacheProvider)
 {
 }
 protected ShippingGatewayProviderBase(IGatewayProviderService gatewayProviderService, IGatewayProvider gatewayProvider, IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProvider, runtimeCacheProvider)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GoogleMapsGeocodeProvider"/> class.
 /// </summary>
 /// <param name="cache">
 /// The cache.
 /// </param>
 public GoogleMapsGeocodeProvider(IRuntimeCacheProvider cache)
     : base(cache)
 {
 }
 public UspsShippingGatewayProvider(IGatewayProviderService gatewayProviderService, 
     IGatewayProviderSettings gatewayProviderSettings, IRuntimeCacheProvider runtimeCacheProvider) : 
     base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {
     _runtimeCache = runtimeCacheProvider;
 }
示例#55
0
 internal static UPSShippingRateTable GetShipRateTable(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider runtimeCacheProvider, Guid shipMethodKey)
 {
     var rows = gatewayProviderService.GetShipRateTiersByShipMethodKey(shipMethodKey);
     return new UPSShippingRateTable(shipMethodKey, rows);
 }
示例#56
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RepositoryFactory"/> class.
 /// </summary>
 /// <param name="disableAllCache">
 /// The disable all cache.
 /// </param>
 /// <param name="nullCacheProvider">
 /// The null cache provider.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="sqlSyntaxProvider">
 /// The SQL syntax provider.
 /// </param>
 public RepositoryFactory(
     bool disableAllCache,
     IRuntimeCacheProvider nullCacheProvider,
     IRuntimeCacheProvider runtimeCacheProvider,
     ILogger logger,
     ISqlSyntaxProvider sqlSyntaxProvider)
 {
     _disableAllCache = disableAllCache;
     _nullCacheProvider = nullCacheProvider;
     _runtimeCacheProvider = runtimeCacheProvider;
     _logger = logger;
     _sqlSyntax = sqlSyntaxProvider;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SampleShippingGatewayProvider"/> class.
 /// </summary>
 /// <param name="gatewayProviderService">
 /// The <see cref="IGatewayProviderService"/>.
 /// </param>
 /// <param name="gatewayProviderSettings">
 /// The <see cref="IGatewayProviderSettings"/>.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// Umbraco's <see cref="IRuntimeCacheProvider"/>.
 /// </param>
 public SampleShippingGatewayProvider(IGatewayProviderService gatewayProviderService, IGatewayProviderSettings gatewayProviderSettings, IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProviderSettings, runtimeCacheProvider)
 {
 }
示例#58
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RepositoryFactory"/> class.
 /// </summary>
 /// <param name="disableAllCache">
 /// The disable all cache.
 /// </param>
 /// <param name="nullCacheProvider">
 /// The null cache provider.
 /// </param>
 /// <param name="runtimeCacheProvider">
 /// The runtime cache provider.
 /// </param>
 public RepositoryFactory(bool disableAllCache, IRuntimeCacheProvider nullCacheProvider, IRuntimeCacheProvider runtimeCacheProvider)
 {
     _disableAllCache = disableAllCache;
     _nullCacheProvider = nullCacheProvider;
     _runtimeCacheProvider = runtimeCacheProvider;
 }
 public TestingShippingGatewayProvider(IGatewayProviderService gatewayProviderService, IGatewayProvider gatewayProvider, IRuntimeCacheProvider runtimeCacheProvider)
     : base(gatewayProviderService, gatewayProvider, runtimeCacheProvider)
 {
 }
示例#60
0
 internal static void Save(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider cache, IUPSShippingRateTable rateTable)
 {
     // persist and enter into cache
        gatewayProviderService.Save(rateTable.Rows);
 }