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

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

absolutePath string
fileSystem IFileSystem

Returns

T

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

absolutePath string
fileSystem IFileSystem

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)
; }