Update: Configuration Framework +CallerMemberName

Simplified creation of configuration modules; Scope is obtained from
abstract, Property names become keys (via CallerMemberName); Simple
generic Get/Set methods are used; Helpers for Obsfucation and Json are
available.
This commit is contained in:
Gary Sharp
2013-05-03 20:48:15 +10:00
parent d19ad7d0dc
commit 8533ec2fe0
23 changed files with 545 additions and 684 deletions
@@ -1,4 +1,5 @@
using System;
using Disco.Data.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,7 +8,7 @@ namespace Disco.Data.Configuration.Modules
{
public class BootstrapperConfiguration : ConfigurationBase
{
public BootstrapperConfiguration(ConfigurationContext Context) : base(Context) { }
public BootstrapperConfiguration(DiscoDataContext dbContext) : base(dbContext) { }
public override string Scope
{
@@ -18,11 +19,11 @@ namespace Disco.Data.Configuration.Modules
{
get
{
return this.GetValue("MacSshUsername", "root");
return this.Get("root");
}
set
{
this.SetValue("MacSshUsername", value);
this.Set(value);
}
}
@@ -30,11 +31,11 @@ namespace Disco.Data.Configuration.Modules
{
get
{
return ConfigurationContext.DeobsfucateValue(this.GetValue("MacSshPassword", string.Empty));
return this.GetDeobsfucated(string.Empty);
}
set
{
this.SetValue("MacSshPassword", ConfigurationContext.ObsfucateValue(value));
this.SetObsfucated(value);
}
}
}