Exemple #1
0
 public ThumbnailLoader(
     IImageLoader imageLoader,
     IAttributeStorage storage,
     IFileSystem fileSystem)
 {
     _fileSystem  = fileSystem;
     _imageLoader = imageLoader;
     _storage     = storage;
 }
        public CachedAttributeStorage(
            [Import(typeof(FileSystemAttributeStorage))] IAttributeStorage persistentStorage,
            [Import(typeof(SqliteAttributeStorage))] IDeferredAttributeStorage cacheStorage)
        {
            _persistentStorage = persistentStorage;
            _cacheStorage      = cacheStorage;

            _writeThread = new Thread(WriteThread)
            {
                Priority = ThreadPriority.Lowest
            };
            _writeThread.Start();
        }
Exemple #3
0
        public void Setup()
        {
            var catalog = new AggregateCatalog(
                new AssemblyCatalog(Assembly.GetAssembly(typeof(Viewer.Data.IEntity))),
                new AssemblyCatalog(Assembly.GetAssembly(typeof(Viewer.Query.IRuntime))),
                new AssemblyCatalog(Assembly.GetAssembly(typeof(Viewer.QueryRuntime.IntValueAdditionFunction))),
                new AssemblyCatalog(Assembly.GetAssembly(typeof(Viewer.IO.IFileSystem))),
                new AssemblyCatalog(Assembly.GetAssembly(typeof(Viewer.Images.IThumbnailLoader))));

            _container = new CompositionContainer(catalog);

            _container.GetExportedValue <IStorageConfiguration>();
            _storage = _container.GetExportedValue <IAttributeStorage>();
            _loader  = _container.GetExportedValue <IThumbnailLoader>();
        }
        public void Setup()
        {
            var catalog = new AggregateCatalog(
                new AssemblyCatalog(Assembly.GetAssembly(typeof(Viewer.Data.IEntity))),
                new AssemblyCatalog(Assembly.GetAssembly(typeof(Viewer.Query.IRuntime))),
                new AssemblyCatalog(Assembly.GetAssembly(typeof(Viewer.QueryRuntime.IntValueAdditionFunction))),
                new AssemblyCatalog(Assembly.GetAssembly(typeof(Viewer.IO.IFileSystem))),
                new TypeCatalog(typeof(ErrorListener)),
                new TypeCatalog(typeof(Configuration)));

            _container = new CompositionContainer(catalog);

            // make SQLite connection factory create and use database in a local file
            var fileSystem = _container.GetExportedValue <IFileSystem>();

            _container.ComposeExportedValue <SQLiteConnectionFactory>(
                new SQLiteConnectionFactory(fileSystem, DatabaseFile));

            _storage = _container.GetExportedValue <IAttributeStorage>();

            // copy data directory
            try
            {
                Directory.Delete(TestDataDir, true);
            }
            catch (DirectoryNotFoundException)
            {
                // this is ok
            }

            Directory.CreateDirectory(TestDataDir);
            foreach (var file in Directory.EnumerateFiles(BaseDir))
            {
                var target = Path.Combine(TestDataDir, Path.GetFileName(file));
                File.Copy(file, target);
            }
        }
Exemple #5
0
 public EntityManager(IAttributeStorage storage)
 {
     _storage = storage;
 }