Skip to content

Prerelease-v0.8.0

Compare
Choose a tag to compare
@YuriyDurov YuriyDurov released this 05 Jan 12:24
· 54 commits to main since this release
a64aca3

Overview

Some updates were made to working with json data

FromJsonFile

Can be used to read json data from a file

services.AddFlux(flux =>
{
    flux.AddService("My-External-Service")
        .UsingJson()
            .WithBaseFilePath("./data") // you can specify base file path to use with FromJsonFile
            .AddSet<TestModel, int>()
                .FromJsonFile("test-model.set.json")
                .WithKey(x => x.Id);
});

FromJson

Can be used to read raw json data as string

var myJson =
    """
    [
        {
            "id": 1,
            "name": "test object 1"
        },
        {
            "id": 2,
            "name": "test object 2"
        }
    ]
    """;

services.AddFlux(flux =>
{
    flux.AddService("My-External-Service")
        .UsingJson()
            .AddSet<TestModel, int>()
                .FromJson(myJson)
                .WithKey(x => x.Id);
});