Mobile // Mobile Applications
00:00 AM
Connect Directly
Repost This

Config Reader Utility

Reshef Mann, one of the members of our devdiv released a nifty little utility for reading configuration files into easy to work-with type-safe interface.
Instead of trying to explain it - Here is the example from his Getting Started :

When you have .config file:

<?xml version="1.0" encoding="utf-8" ?>
<add key="MailNotificationSettings.SmtpServerAddress" value="http://localhost"/>
<add key="MailNotificationSettings.Username" value="user123"/>
<add key="MailNotificationSettings.Password" value="passwd123"/>

Define the following interface:

public interface IMailNotificationSettings
Uri SmtpServerAddress { get; }
string Username { get; }
string Password { get; }

And from your program use this code:

public static void Main()
ConfigurationReader configReader = new ConfigurationReader().SetupConfigOf<IMailNotificationSettings>();
IMailNotificationSettings mailNotificationSettings = configReader.ConfigBrowser.Get<IMailNotificationSettings>();
var mailNotificationService = new MailNotificationService(mailNotificationSettings);
//      Do the work..

The project is open sourced under the Apache 2.0 license- so feel free to use it

Comment  | 
Print  | 
More Insights
Building A Mobile Business Mindset
Building A Mobile Business Mindset
Among 688 respondents, 46% have deployed mobile apps, with an additional 24% planning to in the next year. Soon all apps will look like mobile apps and it's past time for those with no plans to get cracking.
Register for InformationWeek Newsletters
White Papers
Current Issue
InformationWeek Elite 100 - 2014
Our InformationWeek Elite 100 issue -- our 26th ranking of technology innovators -- shines a spotlight on businesses that are succeeding because of their digital strategies. We take a close at look at the top five companies in this year's ranking and the eight winners of our Business Innovation awards, and offer 20 great ideas that you can use in your company. We also provide a ranked list of our Elite 100 innovators.
Twitter Feed
Audio Interviews
Archived Audio Interviews
GE is a leader in combining connected devices and advanced analytics in pursuit of practical goals like less downtime, lower operating costs, and higher throughput. At GIO Power & Water, CIO Jim Fowler is part of the team exploring how to apply these techniques to some of the world's essential infrastructure, from power plants to water treatment systems. Join us, and bring your questions, as we talk about what's ahead.