SetOMatic 1.0.0.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package SetOMatic --version 1.0.0.9
                    
NuGet\Install-Package SetOMatic -Version 1.0.0.9
                    
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="SetOMatic" Version="1.0.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SetOMatic" Version="1.0.0.9" />
                    
Directory.Packages.props
<PackageReference Include="SetOMatic" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SetOMatic --version 1.0.0.9
                    
#r "nuget: SetOMatic, 1.0.0.9"
                    
#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.
#:package SetOMatic@1.0.0.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SetOMatic&version=1.0.0.9
                    
Install as a Cake Addin
#tool nuget:?package=SetOMatic&version=1.0.0.9
                    
Install as a Cake Tool

<a id="readme-top"></a>

<br /> <div align="center">

<img src="SetOMatic.png" alt="Logo" width="200">

<h1 align="center">SetOMatic</h1>

<p align="center"> Simple strongly-typed settings manager </p> </div>

About SetOMatic

As Visual Studio has evolved, the built-in SettingsManager library has fallen far behind in functionality. While nearly all other aspects of code development have been integrated into Intellisense and have become strongly-typed, application settings are still only accessible by default as strings which are not visible via Intellisense.

SetOMatic is a simple set of T4 templates that, when added to any .Net Framework project, automatically creates a strongly-typed Settings class that is dynamically loaded with values from App.config or Web.config at runtime.

Why use SetOMatic?

  • Strongly-typed application settings help prevent runtime errors by allowing the compiler to check the types at compile time
  • As .Net class properties, all settings are available in IntelliSense at design-time, making errors less likely
  • Values in the config file are type-checked at first setting access time, preventing invalid settings from falling through the cracks at runtime
  • Connection strings are automatically available through the Settings object
  • Compiler-checked code is cleaner code. Help the compiler help you!

Features

  • Extremely lightweight. SetOMatic adds a single folder and two code files (total of 19kb)
  • Automates the importing of all configuration settings into a strongly typed Settings static class
  • Automatically loads the current configuration file setting values at runtime into the Settings object
  • Allows the use of IntelliSense to reference all application settings
  • Provides a connectionStrings child class with all connection strings available
  • Seamlessly handles transformed config files since values are loaded at runtime
  • Type-checking at application startup makes it easy to catch invalid values
  • Having strongly typed settings eliminates the need to cast settings to match the type they are being compared to Example:
    <add name="Active" value="true"/> becomes public bool Active {get; set;}
  • The ability to select any setting from IntelliSense greatly reduces the chances of "fat-finger" errors when referencing a setting
  • Overall robustness of application code is increased due to fewer opportunities for errors

Getting Started

Getting started with SetOMatic is simple:

  1. Install
  2. Start using the newly created static Settings class

Prerequisites

SetOMatic works with any .Net Framework project in any Visual Studio version that supports T4 templates. No additional software is required.

Installation

Install the Latest SetOMatic package using the NuGet CLI ( $ dotnet add package SetOMatic --version 1.0.0.7 ) or NuGet Package Manager.

The needed SetOMatic class files (Settings.cs and SetOMatic.cs) will be created automatically in a new Settings folder in the root of the project.

Usage

  1. To use SetOMatic, type Settings. in any code file. IntelliSense will list all available settings. <img src="images/appSettings.png" alt="Using SetOMatic">
  2. Select the setting you wish to use. <img src="images/appSetting2.png" alt="Using SetOMatic">

Settings that are contained in the appSettings section of the config file can be accessed using Settings.appSettings. Custom application settings sections can be accessed using Settings.[custom_section_name]. :

<img src="images/CustomSectionConfig.png" alt="Updating Settings"> <img src="images/CustomSection.png" alt="Updating Settings">

Connection strings contained in the connectionStrings section of the config file can be accessed using Settings.connectionStrings. Custom connection string sections can be accessed using _Settings.[custom connection string section name]. _ <img src="images/connectionString.png" alt="Updating Settings">

Updating settings

If settings are added to or removed from the config file, the Settings class should be updated by right-clicking on the files

/Settings/SetOMatic.tt
/Settings.Settings.tt

and selecting Run custom tool:

<img src="images/RunCustomTool.png" alt="Updating Settings">

The Settings.cs and SetOMatic.cs files will be updated with the new settings.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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.17 133 8/14/2025
1.0.0.16 137 8/14/2025
1.0.0.14 136 8/13/2025
1.0.0.12 239 8/11/2025 1.0.0.12 is deprecated because it has critical bugs.
1.0.0.11 141 8/11/2025
1.0.0.10 142 8/8/2025
1.0.0.9 222 8/6/2025

* Added the ability to use either app.config or web.config
* Added connection strings (default and custom) to the Settings class