DataFiles Pennington.Data
Default IDataFiles implementation that aggregates every registered IDataFile by name. Also the single IFileWatchAware for the data-file subsystem: it fans changes out to its entries.
Properties
NamesIEnumerable<string>- The names of all registered data files.
WatchScopesIReadOnlyList<FileWatchScope>- Directories needing an OS-level watcher. Empty (the default) for aggregators that ride notifications other watchers already produce.
Constructors
DataFiles
#public DataFiles(IEnumerable<IDataFile> entries)
Creates the registry from every IDataFile registered in DI.
Parameters
entriesIEnumerable<IDataFile>
Methods
Get<T>
#public T Get<T>(string name)
Retrieves the loaded value for the data file registered under name.
Parameters
namestring- Logical name supplied when the data file was registered.
Returns
TOnFileChanged
#public FileWatchResponse OnFileChanged(FileChangeNotification change)
Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
Parameters
changeFileChangeNotification
Returns
FileWatchResponseTryGet<T>
#public bool TryGet<T>(string name, out T value)
Tries to retrieve the loaded value for the data file registered under name. Returns false when no data file is registered with that name OR when the registered type does not match T.
Parameters
namestring- Logical name supplied when the data file was registered.
valueref T- The loaded value when the lookup succeeds.
Returns
boolPennington.Data.DataFiles
namespace Pennington.Data;
/// Default IDataFiles implementation that aggregates every registered IDataFile by name. Also the single IFileWatchAware for the data-file subsystem: it fans changes out to its entries.
public class DataFiles
{
/// Creates the registry from every IDataFile registered in DI.
public DataFiles(IEnumerable<IDataFile> entries)
;
/// Retrieves the loaded value for the data file registered under name.
public T Get<T>(string name)
;
/// The names of all registered data files.
public IEnumerable<string> Names { get; }
/// Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
public FileWatchResponse OnFileChanged(FileChangeNotification change)
;
/// Tries to retrieve the loaded value for the data file registered under name. Returns false when no data file is registered with that name OR when the registered type does not match T.
public bool TryGet<T>(string name, out T value)
;
/// Directories needing an OS-level watcher. Empty (the default) for aggregators that ride notifications other watchers already produce.
public IReadOnlyList<FileWatchScope> WatchScopes { get; }
}