DotNetCore.Mps.Runtime 9.0.0

dotnet add package DotNetCore.Mps.Runtime --version 9.0.0                
NuGet\Install-Package DotNetCore.Mps.Runtime -Version 9.0.0                
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="DotNetCore.Mps.Runtime" Version="9.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetCore.Mps.Runtime --version 9.0.0                
#r "nuget: DotNetCore.Mps.Runtime, 9.0.0"                
#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 DotNetCore.Mps.Runtime as a Cake Addin
#addin nuget:?package=DotNetCore.Mps.Runtime&version=9.0.0

// Install DotNetCore.Mps.Runtime as a Cake Tool
#tool nuget:?package=DotNetCore.Mps.Runtime&version=9.0.0                

DotNetCore MicroService Platform Runtime Configuration

DotNetCore.Mps.Runtime - configuration provider that injects into IConfiguration collected runtime information.

Nuget.org

Version: 9.0.x

  • supports netstandard2.0/2.1 ; net9.0

Setup in the project


      // Adds Runtime Configuration
       builder.Configuration.AddMpsRuntimeWithMicroServiceName(typeof(Program).Assembly);

or with exact microservice name.


      // Adds Runtime Configuration
       builder.Configuration.AddMpsRuntimeWithMicroServiceName(microserviceName: "MyMicroserviceName");

Get MpsRuntime class object

     MpsRuntime mpsRuntime = builder.Configuration.GetSection(nameof(MpsRuntime)).Get<MpsRuntime>();
     builder.Services.AddSingleton(mpsRuntime);

IConfiguration Values:

Configuration path/key Value
mps:env Value defined by Environment microservice_environment, default value is dev
mps:msname Microservice name. Value defined by Assembly "AssemblyProductAttribute" attribute or via "MpsRuntimeConfigurationOptions"
mps:docker "true" is runs in docker container
mps:host Value of environment "MachineName"
mps:bus Service bus name either the mps:env value or mps:host
mps:linux "true" when run on linux

Runtime Customization

Use configuration

public class MpsRuntimeConfigurationOptions
{
    /// <summary>
    /// A Microservice assembly; it's used for accessing the <see cref="AssemblyProductAttribute"/>
    /// which is used as MicroserviceName for a runtime configuration.
    /// </summary>
    public Assembly MpsAssembly { get; set; }

    /// <summary>
    /// Set the valid list of configurations.
    /// The default list is  "sbx", "dev", "uat", "qat", "stg", "pdn", "prd" 
    /// </summary>
    public string[] ValidMpsConfigs { get; set; } = MpsRuntimeConfigurationProvider.ValidMpsConfigs;

    /// <summary>
    /// A microservice name. The default name is 'mps-microservice-api'.
    /// </summary>
    public string MicroserviceName { get; set; } = MpsRuntimeConfigurationProvider.DefaultMicroserviceName;

    /// <summary>
    /// A prefix used as name of the section  variables. The default value is 'mps'.
    /// </summary>
    public string Section { get; set; } = MpsRuntimeConfigurationProvider.DefaultSection;

    /// <summary>
    /// An environment name. The default name is 'microservice_environment'.
    /// </summary>
    public string MpsEnvironmentName { get; set; } = MpsRuntimeConfigurationProvider.EnvMpsEnvironment;
}

Runtime information logging

     MpsRuntime mpsRuntime = builder.Configuration.GetSection(nameof(MpsRuntime)).Get<MpsRuntime>();
     builder.Services.AddSingleton(mpsRuntime);
     builder.Services.AddHostedService<MpsLifetimeEventsHostedService>();

Enterprise Configuration Integrations

DotNetCore.Mps.Runtime - can be used with DotNetCore Generic Configuration.

DotNetCore Generic Configuration creates a new configuration values by substituting IConfiguration Keys with Values from other IConfiguration Keys.

References:

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.0 76 12/8/2024
8.0.1 110 5/27/2024
8.0.0 243 11/29/2023