This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

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

Names IEnumerable<string>
The names of all registered data files.
WatchScopes IReadOnlyList<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

entries IEnumerable<IDataFile>

Methods

Get<T>

#
public T Get<T>(string name)

Retrieves the loaded value for the data file registered under name.

Parameters

name string
Logical name supplied when the data file was registered.

Returns

T

OnFileChanged

#
public FileWatchResponse OnFileChanged(FileChangeNotification change)

Called on the file-watcher thread for every watched change. Must be quick and thread-safe.

Parameters

change FileChangeNotification

Returns

FileWatchResponse

TryGet<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

name string
Logical name supplied when the data file was registered.
value ref T
The loaded value when the lookup succeeds.

Returns

bool

Pennington.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; }
}