Paramulate 1.0.0-beta4

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

// Install Paramulate as a Cake Tool
#tool nuget:?package=Paramulate&version=1.0.0-beta4&prerelease

Summary

Paramulate is a powerful framework for parameterising C# code, from command line arguments, programmatic defaults, config files, databases or any other source you like! It allows you to easily print your parameters to an output stream and see where individual settings came from.

Philosophy

Paramulate creates a culture around the design of your components with respect to parameterisation. It hopes to inspire developers to follow these mantras when writing applications and libraries:

  • Separate logic: Paramulate encourages developers to separate business logic from configuration and settings, behaviour should be agnostic to the input mechanism
  • Author knows best: sensible defaults should be provided by developers to make using their component easier
  • Customer knows better: advanced users what to change everything, and they know their use-case best
  • Seeing is believing: you should be able to easily see the inputs to the code
  • I'm no Sherlock: tracking down the source of parameters should be trivial
  • Consistency without constraint: Paramulate encourages consistency, but doesn't force a dependency

Example

Given the code:

    public interface IUserDatabaseParams
    {
        [Default("server=PROD;Database=UserDb")]
        string ConnectionString { get; }
        
        [Default("2")]
        int NumRetries { get; }
    }
    
    public interface ITranslatorParams
    {
        [Default("AutoDetect")]
        [Alias("i", "input-language", "(Optional) Use this to choose the input language. " +
                                      "Either 'AutoDetect' or a supported language (e.g. 'Spanish')")]
        string InputLanguage { get; }
        
        [Alias("o", "output-language", "Use this to choose the output language. " +
                                       "Any supported language (e.g. 'Mandarin')")]
        string OutputLanguage { get; }
        
        [Override("NumRetries", "3")]
        IUserDatabaseParams UserDb { get;}
    }
    
    public class TranslatorApp
    {
        public static int Main(string[] args)
        {
            var builder = ParamsBuilder<ITranslatorParams>.New("App",
                new CommandLineValueProvider(args)
            );
            var parameters = builder.Build();
            builder.WriteParams(parameters, Console.Out);
            // ... App Code ...
            return 0;
        }
    }

and the command

TranslatorApp.exe -o English --App.UserDb.ConnectionString "Server=TEST;Database=UserDb7E2A"

You would have the following parameter object initilaised for you:

App:
  InputLanguage: "AutoDetect" (From Default)
  OutputLanguage: "English" (From Command Line)
  UserDb:
    ConnectionString: "Server=TEST;Database=UserDb7E2A" (From Command Line)
    NumRetries: 3 (From Override on UserDb)
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. 
.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 was computed. 
.NET Framework net461 is compatible.  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
1.0.0-beta4 416 7/14/2019
1.0.0-beta3 343 7/8/2019
1.0.0-beta2 591 8/12/2018
1.0.0-beta1 611 8/7/2018