Paramulate 1.0.0-beta3
See the version list below for details.
dotnet add package Paramulate --version 1.0.0-beta3
NuGet\Install-Package Paramulate -Version 1.0.0-beta3
<PackageReference Include="Paramulate" Version="1.0.0-beta3" />
paket add Paramulate --version 1.0.0-beta3
#r "nuget: Paramulate, 1.0.0-beta3"
// Install Paramulate as a Cake Addin #addin nuget:?package=Paramulate&version=1.0.0-beta3&prerelease // Install Paramulate as a Cake Tool #tool nuget:?package=Paramulate&version=1.0.0-beta3&prerelease
Table of Contents
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)
Features
TODO
Product | Versions 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. |
-
.NETFramework 4.6.1
- ImpromptuInterface (>= 7.0.1)
- Newtonsoft.Json (>= 11.0.2)
-
.NETStandard 2.0
- ImpromptuInterface (>= 7.0.1)
- Newtonsoft.Json (>= 11.0.2)
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 | 426 | 7/14/2019 |
1.0.0-beta3 | 347 | 7/8/2019 |
1.0.0-beta2 | 600 | 8/12/2018 |
1.0.0-beta1 | 616 | 8/7/2018 |