public SystemFileDataStore(EDataStoreType dataStoreType, string rootPath) : base(rootPath) { DataStoreType = dataStoreType; }
/// <summary> /// Get datastore by type from service provider. /// </summary> /// <param name="serviceProvider">Current context of services</param> /// <param name="dataStoreType">Type of datastore</param> /// <returns>Datastore of specified type</returns> private static IDataStore GetDataStore(this IServiceProvider serviceProvider, EDataStoreType dataStoreType) { return(serviceProvider.GetServices <IDataStore>().Single(s => s.DataStoreType == dataStoreType)); }
/// <summary> /// Bind data store to file system path. /// </summary> /// <param name="services">Service collection</param> /// <param name="dataStoreType">Type of data store</param> /// <param name="dataDirectoryPath">Path in filesystem</param> private static void BindSystemFileDataStore(this IServiceCollection services, EDataStoreType dataStoreType, string dataDirectoryPath) { if (!string.IsNullOrEmpty(dataDirectoryPath)) { services.AddScoped <IDataStore, SystemFileDataStore>(o => new SystemFileDataStore(dataStoreType, dataDirectoryPath)); } }
public SystemFileDataStore(EDataStoreType dataStoreType, string rootPath) : base(rootPath) { Log.Information($"Create SystemFileDataStore of type {dataStoreType}"); DataStoreType = dataStoreType; }