public void Initialize()
        {
            var settings = new StorageSettings
            {
                IsSessionAutoClose  = false,
                IsSessionAutoCreate = false,
                IsEnabledFileCache  = true
            };

            dataProvider    = new JsonFileDataProvider();
            inMemoryStorage = new InMemoryStorage(settings);
            subject         = new FileStorage(inMemoryStorage, settings);
        }
        public IInMemoryStorage <T> GetInMemoryStorage <T>()
            where T : class
        {
            lock (gate)
            {
                if (inmemoryStorage == null)
                {
                    inmemoryStorage = new DefaultInMemoryStorage <T>();
                }
                else if (!(inmemoryStorage is IInMemoryStorage <T>))
                {
                    throw new ArgumentException("already initialized inmemory-storage by another type, inmemory-storage only use single type");
                }

                return((IInMemoryStorage <T>)inmemoryStorage);
            }
        }
 public CategoryQueryHandler(IInMemoryStorage inMemoryStorage)
 {
     _inMemoryStorage = inMemoryStorage != null ? inMemoryStorage : throw new ArgumentNullException(nameof(inMemoryStorage));
 }
 public BookRepository(IInMemoryStorage <BookEntity> bookTablestorage)
 {
     _bookTablestorage = bookTablestorage;
     InitData();
 }
 public ProductCommandHandler(IInMemoryStorage inMemoryStorage)
 {
     _inMemoryStorage = inMemoryStorage != null ? inMemoryStorage : throw new ArgumentNullException(nameof(inMemoryStorage));
 }
Exemple #6
0
 public PublishingHouseRepository(IInMemoryStorage <PublishingHouseEntity> publishingHouseTablestorage)
 {
     _publishingHouseTablestorage = publishingHouseTablestorage;
     InitData();
 }
Exemple #7
0
 public FileStorage(IInMemoryStorage inMemoryStorage, StorageSettings settings)
 {
     this.inMemoryStorage = inMemoryStorage;
     dataProvider         = new JsonFileDataProvider();
     this.settings        = settings;
 }
Exemple #8
0
 public FileStorage(StorageSettings settings)
 {
     inMemoryStorage = new InMemoryStorage(settings);
     dataProvider    = new JsonFileDataProvider();
     this.settings   = settings;
 }
Exemple #9
0
 public AuthorRepository(IInMemoryStorage <AuthorEntity> authorTablestorage)
 {
     _authorTablestorage = authorTablestorage;
     InitData();
 }
 public TrainService(IInMemoryStorage inMemoryStorage, IMapper mapper)
 {
     _inMemoryStorage = inMemoryStorage;
     _mapper          = mapper;
 }