Files
Disco/Disco.Data/Configuration/Modules/DeviceProfilesConfiguration.cs
Gary Sharp fb6067afc3 Update: Configuration Optimisation and Caching
Loads entire configuration at start-up (rather than scope-based
loading). Deserialization occurs once, with the resulting value cached
and replayed if the requested type matches.
2014-05-07 22:45:59 +10:00

47 lines
1.1 KiB
C#

using Disco.Data.Repository;
using System;
namespace Disco.Data.Configuration.Modules
{
public class DeviceProfilesConfiguration : ConfigurationBase
{
public DeviceProfilesConfiguration(DiscoDataContext Database) : base(Database) { }
public override string Scope { get { return "DeviceProfiles"; } }
public int DefaultDeviceProfileId
{
get
{
var v = this.Get(1);
if (v > 0)
return v;
else
return 1;
}
set
{
if (value < 1)
throw new ArgumentOutOfRangeException("value", "Expected >= 1");
this.Set(value);
}
}
public int DefaultAddDeviceOfflineDeviceProfileId
{
get
{
return this.Get(0);
}
set
{
if (value < 0)
throw new ArgumentOutOfRangeException("value", "Expected >= 0");
this.Set(value);
}
}
}
}