Ejemplo n.º 1
0
        /// <summary>
        /// IndexBlobService
        /// </summary>
        /// <param name="settings">アプリケーション設定</param>
        /// <param name="logger">ロガー</param>
        /// <param name="collectingRepository">ICollectingRepository</param>
        /// <param name="primaryRepository">IPrimaryRepository</param>
        /// <param name="dtDeviceFileRepository">IDtDeviceFileRepository</param>
        /// <param name="dtDeviceRepository">IDtDeviceRepository</param>
        /// <param name="timeProvider">ITimeProvider</param>
        public IndexBlobService(
            AppSettings settings,
            ILogger <IndexBlobService> logger,
            ICollectingRepository collectingRepository,
            IPrimaryRepository primaryRepository,
            IDtDeviceFileRepository dtDeviceFileRepository,
            IDtDeviceRepository dtDeviceRepository,
            ITimeProvider timeProvider)
        {
            Assert.IfNull(settings);
            Assert.IfNull(logger);
            Assert.IfNull(collectingRepository);
            Assert.IfNull(primaryRepository);
            Assert.IfNull(dtDeviceFileRepository);
            Assert.IfNull(dtDeviceRepository);
            Assert.IfNull(timeProvider);

            _settings               = settings;
            _logger                 = logger;
            _collectingRepository   = collectingRepository;
            _primaryRepository      = primaryRepository;
            _dtDeviceFileRepository = dtDeviceFileRepository;
            _dtDeviceRepository     = dtDeviceRepository;
            _timeProvider           = timeProvider;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="settings">設定</param>
        /// <param name="logger">ロガー</param>
        /// <param name="primaryRepository">プライマリファイルリポジトリ</param>
        /// <param name="dtDeviceFileRepository">デバイスファイルリポジトリ</param>
        /// <param name="timeProvider">TimeProvider</param>
        public CleanBlobService(
            AppSettings settings,
            ILogger <CleanBlobService> logger,
            IPrimaryRepository primaryRepository,
            IDtDeviceFileRepository dtDeviceFileRepository,
            ITimeProvider timeProvider)
        {
            Assert.IfNull(settings);
            Assert.IfNull(logger);
            Assert.IfNull(primaryRepository);
            Assert.IfNull(dtDeviceFileRepository);
            Assert.IfNull(timeProvider);

            _settings = settings;
            _logger   = logger;
            _primaryBlobRepository  = primaryRepository;
            _dtDeviceFileRepository = dtDeviceFileRepository;
            _timeProvider           = timeProvider;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// DIを実行する
        /// </summary>
        /// <param name="appSettings">アプリケーション設定を上書きする場合は指定する</param>
        private void DependencyInjection(Dictionary <string, string> appSettings = null)
        {
            TestDiProviderBuilder builder = new TestDiProviderBuilder();

            builder.ServiceCollection.AddTransient <PrimaryBlob>();

            if (appSettings != null)
            {
                foreach (KeyValuePair <string, string> pair in appSettings)
                {
                    builder.AddConfigure(pair.Key, pair.Value);
                }
            }

            builder.ServiceCollection.AddSingleton <ITimeProvider>(UnitTestHelper.CreateTimeProvider(new DateTime(2030, 1, 1)));
            ServiceProvider provider = builder.Build();

            primaryBlob = provider.GetService <PrimaryBlob>();
            target      = provider.GetService <IPrimaryRepository>();
        }
Ejemplo n.º 4
0
        public PrimaryRepositoryService(IPrimaryRepository repository, ISerializer serializer, IndexMapProvider <T> indexMaps)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }

            if (serializer == null)
            {
                throw new ArgumentNullException(nameof(serializer));
            }

            if (indexMaps == null)
            {
                throw new ArgumentNullException(nameof(indexMaps));
            }

            this.repository = repository;
            this.serializer = serializer;
            this.IndexMaps  = indexMaps;
        }
Ejemplo n.º 5
0
 public PrimaryRepositoryService(IPrimaryRepository repository, ISerializer serializer)
     : this(repository, serializer, new IndexMapProvider <T>())
 {
 }