/// <summary> /// Initializes a new instance of the <see cref="TextFilePropertyStoreFactory"/> class. /// </summary> /// <param name="options">The options for the text file property store</param> /// <param name="deadPropertyFactory">The factory for the dead properties</param> /// <param name="webDavContext">The WebDAV request context</param> /// <param name="logger">The logger for the property store factory</param> public TextFilePropertyStoreFactory(IOptions <TextFilePropertyStoreOptions> options, IDeadPropertyFactory deadPropertyFactory, IWebDavContext webDavContext, ILogger <TextFilePropertyStore> logger) { _options = options?.Value ?? new TextFilePropertyStoreOptions(); _logger = logger; _deadPropertyFactory = deadPropertyFactory; _webDavContext = webDavContext; }
/// <summary> /// Initializes a new instance of the <see cref="TextFilePropertyStore"/> class. /// </summary> /// <param name="options">The options for the text file property store</param> /// <param name="deadPropertyFactory">The factory for the dead properties</param> /// <param name="rootFolder">The root folder where the properties will be stored</param> /// <param name="storeInRootOnly">Store all properties in the same JSON text file</param> /// <param name="storeEntryName">The name of the JSON text file</param> /// <param name="logger">The logger for the property store</param> public TextFilePropertyStore(TextFilePropertyStoreOptions options, IDeadPropertyFactory deadPropertyFactory, string rootFolder, bool storeInRootOnly, string storeEntryName, ILogger <TextFilePropertyStore> logger) : base(deadPropertyFactory) { _logger = logger; _options = options; _storeInRootOnly = storeInRootOnly; _storeEntryName = storeEntryName; RootPath = rootFolder; var rnd = new Random(); _fileReadPolicy = Policy <string> .Handle <IOException>() .WaitAndRetry(100, n => TimeSpan.FromMilliseconds(100 + rnd.Next(-10, 10))); _fileWritePolicy = Policy .Handle <IOException>() .WaitAndRetry(100, n => TimeSpan.FromMilliseconds(100 + rnd.Next(-10, 10))); }