/// <summary>
 /// Initializes a new instance of the <see cref="SQLiteFileSystemFactory"/> class.
 /// </summary>
 /// <param name="options">The options for this file system</param>
 /// <param name="pathTraversalEngine">The engine to traverse paths</param>
 /// <param name="propertyStoreFactory">The store for dead properties</param>
 /// <param name="lockManager">The global lock manager</param>
 public SQLiteFileSystemFactory(
     [NotNull] IOptions <SQLiteFileSystemOptions> options,
     [NotNull] IPathTraversalEngine pathTraversalEngine,
     [CanBeNull] IPropertyStoreFactory propertyStoreFactory = null,
     [CanBeNull] ILockManager lockManager = null)
 {
     _pathTraversalEngine  = pathTraversalEngine;
     _propertyStoreFactory = propertyStoreFactory;
     _lockManager          = lockManager;
     _options = options.Value;
 }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SQLiteFileSystem"/> class.
        /// </summary>
        /// <param name="options">The options for this file system</param>
        /// <param name="mountPoint">The mount point where this file system should be included</param>
        /// <param name="connection">The SQLite database connection</param>
        /// <param name="pathTraversalEngine">The engine to traverse paths</param>
        /// <param name="lockManager">The global lock manager</param>
        /// <param name="propertyStoreFactory">The store for dead properties</param>
        public SQLiteFileSystem(
            [NotNull] SQLiteFileSystemOptions options,
            [CanBeNull] ICollection mountPoint,
            [NotNull] db::SQLiteConnection connection,
            [NotNull] IPathTraversalEngine pathTraversalEngine,
            [CanBeNull] ILockManager lockManager = null,
            [CanBeNull] IPropertyStoreFactory propertyStoreFactory = null)
        {
            RootDirectoryPath    = Path.GetDirectoryName(connection.DatabasePath);
            LockManager          = lockManager;
            _connection          = connection;
            _pathTraversalEngine = pathTraversalEngine;
            Options       = options;
            PropertyStore = propertyStoreFactory?.Create(this);
            var rootEntry = connection.Table <FileEntry>().Where(x => x.Id == string.Empty).ToList().Single();
            var rootPath  = mountPoint?.Path ?? new Uri(string.Empty, UriKind.Relative);
            var rootDir   = new SQLiteCollection(this, mountPoint, rootEntry, rootPath, mountPoint?.Name ?? rootPath.GetName(), true);

            Root = new AsyncLazy <ICollection>(() => Task.FromResult <ICollection>(rootDir));
        }