DataFileLoader Pennington.Data
Deserializes a data file's bytes into a typed value. Format is chosen from the extension (.yml / .yaml use SharpYaml, .json uses System.Text.Json), both configured with camelCase naming and case-insensitive property matching to mirror FrontMatterParser's behavior. Arbitrary data types deserialize via reflection (no source-gen context covers them).
Methods
Load<T>
#public static T Load<T>(string absolutePath, IFileSystem fileSystem)
Reads absolutePath through fileSystem and deserializes it into T.
Parameters
absolutePathstringfileSystemIFileSystem
Returns
TLoadMany<TItem>
#public static IReadOnlyList<TItem> LoadMany<TItem>(string absolutePath, IFileSystem fileSystem)
Reads absolutePath through fileSystem and deserializes it into a list of TItem. A file whose root is an array yields its elements; a file whose root is a single record yields a one-element list.
Parameters
absolutePathstringfileSystemIFileSystem
Returns
IReadOnlyList<TItem>Pennington.Data.DataFileLoader
namespace Pennington.Data;
/// Deserializes a data file's bytes into a typed value. Format is chosen from the extension (.yml / .yaml use SharpYaml, .json uses System.Text.Json), both configured with camelCase naming and case-insensitive property matching to mirror FrontMatterParser's behavior. Arbitrary data types deserialize via reflection (no source-gen context covers them).
public class DataFileLoader
{
/// Reads absolutePath through fileSystem and deserializes it into T.
public static T Load<T>(string absolutePath, IFileSystem fileSystem)
;
/// Reads absolutePath through fileSystem and deserializes it into a list of TItem. A file whose root is an array yields its elements; a file whose root is a single record yields a one-element list.
public static IReadOnlyList<TItem> LoadMany<TItem>(string absolutePath, IFileSystem fileSystem)
;
}