public FileSystemContentBlobProvider(IOptions <FileSystemBlobContentOptions> options, IMemoryCache memoryCache) { _options = options.Value; _memoryCache = memoryCache; //Create fileSystemWatcher instance only when rootFolder exist to prevent whole application crash on initialization phase. if (Directory.Exists(_options.Path)) { _fileSystemWatcher = new PhysicalFilesWatcher(_options.Path, new FileSystemWatcher(_options.Path), _options.PollForChanges); } }
public FileSystemContentBlobProvider(IOptions <FileSystemBlobContentOptions> options, IStorefrontMemoryCache memoryCache) { _options = options.Value; _memoryCache = memoryCache; //Create fileSystemWatcher instance only when rootFolder exist to prevent whole application crash on initialization phase. if (Directory.Exists(_options.Path)) { //It is very important to have rootPath with leading slash '\' without this any changes won't reflected var rootPath = _options.Path.TrimEnd('\\') + '\\'; _fileSystemWatcher = new PhysicalFilesWatcher(rootPath, new FileSystemWatcher(rootPath), false); } }