示例#1
0
        public EmailSender(
            IEnumerable <IEmailProviderType> emailProviderTypes,
            IOptions <EmailOptions> options,
            IStorageFactory storageFactory,
            ITemplateLoaderFactory templateLoaderFactory)
        {
            this.options = options.Value;

            var providerType = emailProviderTypes
                               .FirstOrDefault(x => x.Name == this.options.Provider.Type);

            if (providerType == null)
            {
                throw new ArgumentNullException("ProviderType", $"The provider type {this.options.Provider.Type} does not exist. Maybe you are missing a reference or an Add method call in your Startup class.");
            }

            this.provider = providerType.BuildProvider(this.options.Provider);

            if (!string.IsNullOrWhiteSpace(this.options.TemplateStorage))
            {
                var store = storageFactory.GetStore(this.options.TemplateStorage);
                if (store == null)
                {
                    throw new ArgumentNullException("TemplateStorage", $"There is no file store configured with name {this.options.TemplateStorage}. Unable to initialize email templating.");
                }

                this.templateLoader = templateLoaderFactory.Create(store);
            }
        }
示例#2
0
 public CategoryService(
     IStorageFactory <IDevFunStorage> storageFactory,
     ILogger <CategoryService> logger)
 {
     this.StorageFactory = storageFactory ?? throw new ArgumentNullException(nameof(storageFactory));
     this.Logger         = logger ?? throw new ArgumentNullException(nameof(logger));
 }
示例#3
0
        public void StorageFactoryCreationTest(TargetStorage targetStorage, Type factoryType)
        {
            StorageFactoryFactory factoryFactory = new StorageFactoryFactory();
            IStorageFactory       storageFactory = factoryFactory.CreateStorageFactory(targetStorage);

            Assert.True(storageFactory.GetType().Equals(factoryType));
        }
 public DevJokeService(
     IStorageFactory <IDevFunStorage> storageFactory,
     ILoggerFactory loggerFactory)
 {
     this.StorageFactory = storageFactory ?? throw new ArgumentNullException(nameof(storageFactory));
     this.Logger         = loggerFactory.CreateLogger(nameof(DevJokeService));
 }
示例#5
0
 public VegetableStorage(BuildingCollection ctx, IStorageFactory factory, Vector posVector)
 {
     CtxCollection = ctx;
     PosVector     = posVector;
     Factory       = factory;
     Capacity      = FarmOptions.DefaultVegetableCapacity;
     MaxCapacity   = FarmOptions.DefaultVegetableMaxCapacity;
 }
示例#6
0
        public Engine(IStorageFactory storageFactory)
        {
            _storageFactory = storageFactory;
            _collections    = new ConcurrentDictionary <string, ICollection>();
            _writer         = new NeverendingTask(Flush);

            _writer.Start();
        }
示例#7
0
 public SeedStorage(BuildingCollection ctx, IStorageFactory factory, Vector posVector)
 {
     CtxCollection = ctx;
     PosVector     = posVector;
     Factory       = factory;
     Capacity      = FarmOptions.DefaultSeedCapacity;
     MaxCapacity   = FarmOptions.DefaultSeedMaxCapacity;
 }
 public StorageMaster(IProductFactory productFactory, IProductRepository productRepository, IStorageFactory storageFactory, IStorageRepository storageRepository)
 {
     this.productFactory    = productFactory;
     this.productRepository = productRepository;
     this.storageFactory    = storageFactory;
     this.storageRepository = storageRepository;
     this.currentVehicle    = null;
 }
示例#9
0
 public EggStorage(BuildingCollection ctx, IStorageFactory factory, Vector posVector)
 {
     CtxCollection = ctx;
     Factory       = factory;
     PosVector     = posVector;
     Capacity      = FarmOptions.DefaultEggCapacity;
     MaxCapacity   = FarmOptions.DefaultEggMaxCapacity;
 }
示例#10
0
        public GenericStoreProxy(IStorageFactory factory, IOptions <TOptions> options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options", "Unable to build generic Store. Did you forget to configure your options?");
            }

            this.innerStore = factory.GetStore(options.Value.Name, options.Value);
        }
 public MessageRepository(IStorageFactory storageFactory, IMessageCreated messageCreated, IAutomapper mapper,
                          IFilterMessages filterMessages, ICreatePagination <MessageEntity> createPagination)
 {
     _storage          = storageFactory.Make();
     _messageCreated   = messageCreated;
     _mapper           = mapper;
     _filterMessages   = filterMessages;
     _createPagination = createPagination;
 }
示例#12
0
 public RedirectableStore(
     IStorageFactory storageFactory,
     IKeyFactory keyFactory,
     IMapper mapper)
 {
     _storageFactory = storageFactory;
     _keyFactory     = keyFactory;
     _mapper         = mapper;
 }
示例#13
0
        private static KeyValuePair <string, DurableCursor> GetDurableCursor(IStorageFactory storageFactory, string name)
        {
            var cursorStorage = storageFactory.Create();
            var cursorUri     = cursorStorage.ResolveUri(name);

            return(new KeyValuePair <string, DurableCursor>(
                       cursorUri.AbsoluteUri,
                       new DurableCursor(cursorUri, cursorStorage, DateTime.MinValue)));
        }
示例#14
0
        private void InitializeStorage(StorageType sourceStorageType, StorageType destinationStorageType)
        {
            IStorageFactory sourceFactory      = _storageFactoryFactory.CreateStorageFactory(TargetStorage.Source);
            IStorageFactory destinationFactory = _storageFactoryFactory.CreateStorageFactory(TargetStorage.Destination);
            var             storageConfigModel = _configurationService.GetStorageConfigModel();

            _sourceStorageService      = sourceFactory.CreateStorageService(sourceStorageType, storageConfigModel);
            _destinationStorageService = destinationFactory.CreateStorageService(destinationStorageType, storageConfigModel);
        }
        public static async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] GridEvent <JObject>[] gridEvents,
            [Table(nameof(Collections.Events), Connection = AppSettingContainingConnectionString)] CloudTable eventsTable,
            [Inject(typeof(IStorageFactory <EventHistoryTableEntity>))] IStorageFactory <EventHistoryTableEntity> storageFactory,
            ILogger logger)
        {
            var eventProcessor = new EventHistoryProcessor(gridEvents, storageFactory.Create(eventsTable), logger);

            return(await ProcessorRunner.Run(eventProcessor));
        }
示例#16
0
 public FileController(IStorageFactory storageFactory,
                       IPostService postService,
                       IFileService fileService,
                       IGroupService groupService)
 {
     this.fileStore    = storageFactory.GetStore("LocalFileStorage");
     this.postService  = postService;
     this.fileService  = fileService;
     this.groupService = groupService;
 }
示例#17
0
 public RecordFlush(ISetupMonitorConfig setupMonitorConfig, IDataCache cache, IStorageCommands storageCommands, IRecordFlushUpdate logic, IStorageFactory dbFactory, ISettings settings)
 {
     _logger = settings.LoggerProvider.CreateLogger(typeof(RecordFlush));
     _setupMonitorConfig = setupMonitorConfig;
     _cache = cache;
     _storageCommands = storageCommands;
     _logic = logic;
     _dbFactory = dbFactory;
     _settings = settings;
 }
示例#18
0
        public StorageMaster()
        {
            this.productFactory = new ProductFactory();
            this.storageFactory = new StorageFactory();
            this.vehicleFactory = new VehicleFactory();

            this.productPool     = new List <Product>();
            this.storageRegistry = new List <Storage>();
            this.currentVehicle  = null;
        }
示例#19
0
 public AddImageCommandHandler(
     IImageProcessingFactory imageProcessingFactory,
     IStorageFactory storageFactory,
     ILogger <AddImageCommandHandler> logger
     )
 {
     _imageProcessingFactory = imageProcessingFactory;
     _storageFactory         = storageFactory;
     _logger = logger;
 }
 public MethodPerformanceAdvisor(IStopwatch stopwatch, 
     IGlimpsePerformanceConfiguration glimpsePerformanceConfiguration,
     IStorageFactory storageFactory,
     IConversionHelper conversionHelper)
 {
     GlimpsePerformanceConfiguration = glimpsePerformanceConfiguration;
     Stopwatch = stopwatch;
     StorageFactory = storageFactory;
     Stopwatch.Start();
     ConversionHelper = conversionHelper;
 }
 public SyncFoldersReader(
     DirDbContext db,
     IStorage remoteStorage,
     string deviceName,
     IStorageFactory storageFactory)
 {
     this.db             = db;
     this.remoteStorage  = remoteStorage;
     this.deviceName     = deviceName;
     this.storageFactory = storageFactory;
 }
 public RenewalOptionParser(
     IAzureHelper azureHelper,
     IKeyVaultClient keyVaultClient,
     IStorageFactory storageFactory,
     ILogger logger)
 {
     _azureHelper    = azureHelper ?? throw new ArgumentNullException(nameof(azureHelper));
     _keyVaultClient = keyVaultClient ?? throw new ArgumentNullException(nameof(keyVaultClient));
     _storageFactory = storageFactory ?? throw new ArgumentNullException(nameof(storageFactory));
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public Catalog2ElfieOptions(Version indexerVersion, Version mergerVersion, string source, string downloadSource, double downloadPercentage, IStorageFactory storageFactory, int maxThreads, string tempPath, bool verbose)
 {
     this.IndexerVersion = indexerVersion;
     this.MergerVersion = mergerVersion;
     this.Source = source;
     this.DownloadSource = downloadSource;
     this.DownloadPercentage = downloadPercentage;
     this.StorageFactory = storageFactory;
     this.MaxThreads = maxThreads;
     this.TempPath = tempPath;
     this.Verbose = verbose;
 }
示例#24
0
 public RecordReduce(IRecordReduceStatus reduceStatus, IRecordReduceAggregate reduceAggregater, IDataCache cache, IRecordCompare recordCompare, IStorageCommands storageCommands, IStorageFactory dbFactory, ISettings settings)
 {
     _logger = settings.LoggerProvider.CreateLogger(typeof(RecordReduce));
     _configSeed = settings.ConfigSeed;
     _reduceStatus = reduceStatus;
     _reduceAggregater = reduceAggregater;
     _cache = cache;
     _recordCompare = recordCompare;
     _storageCommands = storageCommands;
     _dbFactory = dbFactory;
     _settings = settings;
 }
        /// <summary>
        /// Get or create new storage in a resource group.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="resourceGroup"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static async Task <IStorageResource> GetOrCreateAsync(
            this IStorageFactory service, IResourceGroupResource resourceGroup,
            string name)
        {
            var resource = await Try.Async(() => service.GetAsync(resourceGroup,
                                                                  name));

            if (resource == null)
            {
                resource = await service.CreateAsync(resourceGroup, name);
            }
            return(resource);
        }
示例#26
0
        static async Task SetupAndRunTests(this IStorageFactory storageFactory, TimeSpan?withDelay = null)
        {
            using var folderChangeWatcher = storageFactory.CreateChangeWatcher();
            using var subscription        = folderChangeWatcher.FolderChanged.Subscribe(path =>
            {
                Console.ForegroundColor = ConsoleColor.DarkMagenta;
                Console.WriteLine($"File in folder '{path}' was changed");
                Console.ForegroundColor = ConsoleColor.Black;
            });
            //Task.Run(() => { Thread.Sleep(4000); subscription.Dispose(); Console.WriteLine("subscription cancelled"); });
            await storageFactory.CreateStorageService().RunTestActions(withDelay);

            await Task.Delay(1000);
        }
 public Catalog2RegistrationCommand(
     ICollector collector,
     ICloudBlobClient cloudBlobClient,
     IStorageFactory storageFactory,
     Func <HttpMessageHandler> handlerFunc,
     IOptionsSnapshot <Catalog2RegistrationConfiguration> options,
     ILogger <Catalog2RegistrationCommand> logger)
 {
     _collector       = collector ?? throw new ArgumentNullException(nameof(collector));
     _cloudBlobClient = cloudBlobClient ?? throw new ArgumentNullException(nameof(cloudBlobClient));
     _storageFactory  = storageFactory ?? throw new ArgumentNullException(nameof(storageFactory));
     _handlerFunc     = handlerFunc ?? throw new ArgumentNullException(nameof(handlerFunc));
     _options         = options ?? throw new ArgumentNullException(nameof(options));
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        public StorageWorkerViewModel(IStorageFactory storageFactory, ISortStudentsForm sortStudentsForm, IStudentForm studentForm)
        {
            _storageFactory   = storageFactory;
            _sortStudentsForm = sortStudentsForm;
            _studentForm      = studentForm;

            CreateStorageCommand = new DelegateCommand(CreateStorage);
            OpenStorageCommand   = new DelegateCommand(OpenStorage);
            _saveStudentsCommand = new DelegateCommand(SaveStudents, () => _storage != null);

            _students = new ObservableCollection <StudentModel>();

            _sortStudentsForm.SearchSubmitted += SortStudentsFormOnSearchSubmitted;
            _studentForm.StudentSubmitted     += (sender, e) => _storage.Add(e.Student);
        }
 public RegistrationComparerCommand(
     ICollector collector,
     CloudStorageAccount storageAccount,
     IStorageFactory storageFactory,
     Func <HttpMessageHandler> handlerFunc,
     IOptionsSnapshot <RegistrationComparerConfiguration> options,
     ILogger <RegistrationComparerCommand> logger)
 {
     _collector      = collector ?? throw new ArgumentNullException(nameof(collector));
     _storageAccount = storageAccount ?? throw new ArgumentNullException(nameof(storageAccount));
     _storageFactory = storageFactory ?? throw new ArgumentNullException(nameof(storageFactory));
     _handlerFunc    = handlerFunc ?? throw new ArgumentNullException(nameof(handlerFunc));
     _options        = options ?? throw new ArgumentNullException(nameof(options));
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public RenewalOptionParser(
     IAzureHelper azureHelper,
     IKeyVaultFactory keyVaultFactory,
     IStorageFactory storageFactory,
     IAzureAppServiceClient azureAppServiceClient,
     IAzureCdnClient azureCdnClient,
     ILoggerFactory loggerFactory)
 {
     _azureHelper           = azureHelper;
     _keyVaultFactory       = keyVaultFactory;
     _storageFactory        = storageFactory;
     _azureAppServiceClient = azureAppServiceClient;
     _azureCdnClient        = azureCdnClient;
     _loggerFactory         = loggerFactory;
     _logger = loggerFactory.CreateLogger <RenewalOptionParser>();
 }
示例#31
0
 public RenewalOptionParser(
     IAzureHelper azureHelper,
     IKeyVaultClient keyVaultClient,
     IStorageFactory storageFactory,
     IAzureAppServiceClient azureAppServiceClient,
     IAzureCdnClient azureCdnClient,
     ILoggerFactory loggerFactory)
 {
     _azureHelper           = azureHelper ?? throw new ArgumentNullException(nameof(azureHelper));
     _keyVaultClient        = keyVaultClient ?? throw new ArgumentNullException(nameof(keyVaultClient));
     _storageFactory        = storageFactory ?? throw new ArgumentNullException(nameof(storageFactory));
     _azureAppServiceClient = azureAppServiceClient;
     _azureCdnClient        = azureCdnClient;
     _loggerFactory         = loggerFactory;
     _logger = loggerFactory.CreateLogger <RenewalOptionParser>();
 }
示例#32
0
 public Catalog2AzureSearchCommand(
     ICollector collector,
     IStorageFactory storageFactory,
     Func <HttpMessageHandler> handlerFunc,
     IBlobContainerBuilder blobContainerBuilder,
     IIndexBuilder indexBuilder,
     IOptionsSnapshot <Catalog2AzureSearchConfiguration> options,
     ILogger <Catalog2AzureSearchCommand> logger)
 {
     _collector            = collector ?? throw new ArgumentNullException(nameof(collector));
     _storageFactory       = storageFactory ?? throw new ArgumentNullException(nameof(storageFactory));
     _handlerFunc          = handlerFunc ?? throw new ArgumentNullException(nameof(handlerFunc));
     _blobContainerBuilder = blobContainerBuilder ?? throw new ArgumentNullException(nameof(blobContainerBuilder));
     _indexBuilder         = indexBuilder ?? throw new ArgumentNullException(nameof(indexBuilder));
     _options = options ?? throw new ArgumentNullException(nameof(options));
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
 }
示例#33
0
 public StorageHub(ILogger <StorageHub> logger,
                   CredentialsConfiguration credentialsConfiguration,
                   IStorageHubRepository storageHubRepository,
                   ITenantRepository tenantMemoryRepository,
                   IStorageFactory storageFactory,
                   IAgentFactory agentFactory,
                   IConsumerHubService consumerHubService,
                   IProducerHubService producerHubService)
 {
     this.logger = logger;
     this.credentialsConfiguration = credentialsConfiguration;
     this.storageHubRepository     = storageHubRepository;
     this.tenantMemoryRepository   = tenantMemoryRepository;
     this.storageFactory           = storageFactory;
     this.agentFactory             = agentFactory;
     this.consumerHubService       = consumerHubService;
     this.producerHubService       = producerHubService;
 }
示例#34
0
 /**
  * Attempts to set the storage factory for the current environment and fails and dies if there
  * is already a storage factory set if specified. Should be used by actual applications who need to use
  * a specific storage factory and shouldn't tolerate being pre-empted.
  *
  * @param fact An available storage factory.
  * @param mustWork true if it is intolerable for another storage factory to have been set. False otherwise
  */
 public static void setStorageFactory(IStorageFactory fact, Boolean mustWork)
 {
     if (storageFactory == null)
     {
         storageFactory = fact;
     }
     else
     {
         if (mustWork)
         {
             Logger.die("A Storage Factory had already been set when storage factory " + fact.GetType().FullName + " attempted to become the only storage factory", new System.SystemException("Duplicate Storage Factory set"));
         }
         else
         {
             //Not an issue
         }
     }
 }
示例#35
0
 public DatabaseStorage()
 {
     _storageFactory = new Mcs.Service.Storage.Database.Factory();
 }
示例#36
0
 public SetupSystem(ISetupSystemTables setupSystemTables, ISetupSystemData setupSystemData, IStorageFactory storageFactory)
 {
     _setupSystemTables = setupSystemTables;
     _setupSystemData = setupSystemData;
     _storageFactory = storageFactory;
 }
示例#37
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Pool" /> class.
        /// </summary>
        /// <param name="hashAlgorithmFactory">The hash algorithm factory.</param>
        /// <param name="serverFactory">The server factory.</param>
        /// <param name="serviceFactory">The service factory.</param>
        /// <param name="client">The client.</param>
        /// <param name="minerManagerFactory">The miner manager factory.</param>
        /// <param name="jobTrackerFactory"></param>
        /// <param name="jobManagerFactory">The job manager factory.</param>
        /// <param name="shareManagerFactory">The share manager factory.</param>
        /// <param name="storageManagerFactory"></param>
        /// <param name="globalConfigFactory"></param>
        public Pool(
            IHashAlgorithmFactory hashAlgorithmFactory, 
            IServerFactory serverFactory, 
            IServiceFactory serviceFactory,
            IDaemonClient client, 
            IMinerManagerFactory minerManagerFactory, 
            IJobTrackerFactory jobTrackerFactory,
            IJobManagerFactory jobManagerFactory, 
            IShareManagerFactory shareManagerFactory,
            IStorageFactory storageManagerFactory,
            IGlobalConfigFactory globalConfigFactory)
        {
            Enforce.ArgumentNotNull(hashAlgorithmFactory, "IHashAlgorithmFactory");
            Enforce.ArgumentNotNull(serverFactory, "IServerFactory");
            Enforce.ArgumentNotNull(serviceFactory, "IServiceFactory");
            Enforce.ArgumentNotNull(client, "IDaemonClient");
            Enforce.ArgumentNotNull(minerManagerFactory, "IMinerManagerFactory");
            Enforce.ArgumentNotNull(jobTrackerFactory, "IJobTrackerFactory");
            Enforce.ArgumentNotNull(jobManagerFactory, "IJobManagerFactory");
            Enforce.ArgumentNotNull(shareManagerFactory, "IShareManagerFactory");
            Enforce.ArgumentNotNull(storageManagerFactory, "IStorageFactory");
            Enforce.ArgumentNotNull(globalConfigFactory, "IGlobalConfigFactory");

            _daemonClient = client;
            _minerManagerFactory = minerManagerFactory;
            _jobManagerFactory = jobManagerFactory;
            _jobTrackerFactory = jobTrackerFactory;
            _shareManagerFactory = shareManagerFactory;
            _serverFactory = serverFactory;
            _serviceFactory = serviceFactory;
            _hashAlgorithmFactory = hashAlgorithmFactory;
            _storageManagerFactory = storageManagerFactory;
            _globalConfigFactory = globalConfigFactory;

            GenerateInstanceId();
        }
示例#38
0
 public static void SetStorageFactory(IStorageFactory storage)
 {
     storageFactory = storage;
 }
示例#39
0
        /// <summary>
        /// Initialize mock objects.
        /// </summary>
        public PoolTests()
        {
            _jobManagerFactory = Substitute.For<IJobManagerFactory>();
            _jobTrackerFactory = Substitute.For<IJobTrackerFactory>();
            _hashAlgorithmFactory = Substitute.For<IHashAlgorithmFactory>();
            _shareManagerFactory = Substitute.For<IShareManagerFactory>();
            _minerManagerFactory = Substitute.For<IMinerManagerFactory>();
            _serverFactory = Substitute.For<IServerFactory>();
            _serviceFactory = Substitute.For<IServiceFactory>();
            _storageManagerFactory = Substitute.For<IStorageFactory>();
            _globalConfigFactory = Substitute.For<IGlobalConfigFactory>();

            _daemonClient = Substitute.For<IDaemonClient>();
            _minerManager = Substitute.For<IMinerManager>();
            _jobManager = Substitute.For<IJobManager>();
            _jobTracker = Substitute.For<IJobTracker>();
            _shareManager = Substitute.For<IShareManager>();
            _miningServer = Substitute.For<IMiningServer>();
            _rpcService = Substitute.For<IRpcService>();
            _storage = Substitute.For<IStorage>();
        }