MakoIoT.Device.Services.Configuration 1.0.44.911

dotnet add package MakoIoT.Device.Services.Configuration --version 1.0.44.911
NuGet\Install-Package MakoIoT.Device.Services.Configuration -Version 1.0.44.911
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MakoIoT.Device.Services.Configuration" Version="1.0.44.911" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MakoIoT.Device.Services.Configuration --version 1.0.44.911
#r "nuget: MakoIoT.Device.Services.Configuration, 1.0.44.911"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MakoIoT.Device.Services.Configuration as a Cake Addin
#addin nuget:?package=MakoIoT.Device.Services.Configuration&version=1.0.44.911

// Install MakoIoT.Device.Services.Configuration as a Cake Tool
#tool nuget:?package=MakoIoT.Device.Services.Configuration&version=1.0.44.911

Mako-IoT.Device.Services.Configuration

Provides easy way of reading and updating configuration settings with strongly-typed objects. Settings are stored in persistent storage via IStorageService.

Usage

Create class for your settings. You may use multiple classes, one for every component. Provide section name as static/const string.

public class MyAppConfig
{
    public string ApiUrl { get; set; }
    public string SslCertificate { get; set; }
    public string Timezone { get; set; }
    public static string SectionName => "MyAppConfig";
}

Use IConfigurationService to read and/or update settings.

public class MyAppService : IMyAppService
{
    private readonly MyAppConfig _config;

    public MyAppService(IConfigurationService configService)
    {
        _config = (MyAppService)configService.GetConfigSection(MyAppService.SectionName, typeof(MyAppService));
    }
//[...]
}

Add Configuration and FileStorage components in your device builder. You can specify default settings, which will be written on startup.

public class Program
{
    public static void Main()
    {
        DeviceBuilder.Create()
          .AddConfiguration(c =>
          {
              c.WriteDefault(MyAppConfig.SectionName, new MyAppConfig
              {
                  ApiUrl = "http://my-app.my-company.com/api"
              });
          })
          .AddFileStorage()
          .Build()
          .Start();

        Thread.Sleep(Timeout.InfiniteTimeSpan);
    }
}

Note: setting overwrite = true in the WriteDefault will overwrite settings with the defaults every time (even if settings already exist).

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on MakoIoT.Device.Services.Configuration:

Package Downloads
MakoIoT.Device.Services.ConfigurationManager

Configuration mode manager for MAKO-IoT

MakoIoT.Device.Services.ConfigurationApi

REST API for configuration with MAKO-IoT

MakoIoT.Device.Platform.LocalConfig

MAKO-IoT Platform local configuration library. On-device web server, WiFi AP

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.44.911 466 4/9/2024
1.0.43.25265 161 4/8/2024
1.0.42.31032 315 4/3/2024
1.0.41.11032 303 3/23/2024
1.0.40.13779 230 3/21/2024
1.0.39.3446 1,567 1/6/2024
1.0.38.57711 347 12/30/2023
1.0.37.47513 191 12/30/2023
1.0.36.62303 704 12/2/2023
1.0.35.24200 224 12/1/2023
1.0.34.49211 395 11/17/2023
1.0.33.44373 221 11/16/2023
1.0.32.19851 324 11/12/2023
1.0.31.51806 1,011 10/9/2023
1.0.30.25325 321 10/6/2023
1.0.29.64214 275 10/4/2023
1.0.27.26144 882 5/29/2023
1.0.25.42009 391 5/25/2023
1.0.24.48276 263 5/25/2023
1.0.21.23813 116 5/22/2023
1.0.20.48349 265 5/22/2023