Posts Tagged 'T4'

T4Configuration: Automated .Config settings

UPDATE: T4Configuration has been updated see here for info.

UPDATE: Source code is available at https://github.com/tornal/T4Configuration

I have created a quick and dirty T4 script to run in Microsoft Visual Studio that will automatically generate a static C# class with properties for every <appSetting> and <connectionString>. You can then access them like so:

 1: String conn = Config.MyDataContext;

Not a million miles away from how T4MVC works.

It is a simple little utility that I hope automates something a lot of us do or have built a shared library to do.

Source code will follow soon. Its all on a BSD do what you will license.

Get it through Nuget or type “Install-Package T4Configuration” in your package manager console.