GIT: perform LF normalization
This commit is contained in:
+19
-19
@@ -1,20 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="DiscoDataContext" connectionString="data source=(local);Initial Catalog=Disco;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True" />
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
</entityFramework>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="DiscoDataContext" connectionString="data source=(local);Initial Catalog=Disco;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True" />
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
</entityFramework>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -1,36 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Disco.Data.Configuration
|
||||
{
|
||||
public abstract class ConfigurationBase
|
||||
{
|
||||
private ConfigurationContext _context;
|
||||
|
||||
public ConfigurationContext Context
|
||||
{
|
||||
get
|
||||
{
|
||||
return _context;
|
||||
}
|
||||
}
|
||||
public abstract string Scope { get; }
|
||||
|
||||
public ConfigurationBase(ConfigurationContext Context)
|
||||
{
|
||||
this._context = Context;
|
||||
}
|
||||
|
||||
protected void SetValue<ValueType>(string Key, ValueType Value)
|
||||
{
|
||||
this.Context.SetConfigurationValue(this.Scope, Key, Value);
|
||||
}
|
||||
protected ValueType GetValue<ValueType>(string Key, ValueType Default)
|
||||
{
|
||||
return this.Context.GetConfigurationValue(this.Scope, Key, Default);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Disco.Data.Configuration
|
||||
{
|
||||
public abstract class ConfigurationBase
|
||||
{
|
||||
private ConfigurationContext _context;
|
||||
|
||||
public ConfigurationContext Context
|
||||
{
|
||||
get
|
||||
{
|
||||
return _context;
|
||||
}
|
||||
}
|
||||
public abstract string Scope { get; }
|
||||
|
||||
public ConfigurationBase(ConfigurationContext Context)
|
||||
{
|
||||
this._context = Context;
|
||||
}
|
||||
|
||||
protected void SetValue<ValueType>(string Key, ValueType Value)
|
||||
{
|
||||
this.Context.SetConfigurationValue(this.Scope, Key, Value);
|
||||
}
|
||||
protected ValueType GetValue<ValueType>(string Key, ValueType Default)
|
||||
{
|
||||
return this.Context.GetConfigurationValue(this.Scope, Key, Default);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
public class BootstrapperConfiguration : ConfigurationBase
|
||||
{
|
||||
public BootstrapperConfiguration(ConfigurationContext Context) : base(Context) { }
|
||||
|
||||
public override string Scope
|
||||
{
|
||||
get { return "Bootstrapper"; }
|
||||
}
|
||||
|
||||
public string MacSshUsername
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("MacSshUsername", "root");
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SetValue("MacSshUsername", value);
|
||||
}
|
||||
}
|
||||
|
||||
public string MacSshPassword
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConfigurationContext.DeobsfucateValue(this.GetValue("MacSshPassword", string.Empty));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SetValue("MacSshPassword", ConfigurationContext.ObsfucateValue(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
public class BootstrapperConfiguration : ConfigurationBase
|
||||
{
|
||||
public BootstrapperConfiguration(ConfigurationContext Context) : base(Context) { }
|
||||
|
||||
public override string Scope
|
||||
{
|
||||
get { return "Bootstrapper"; }
|
||||
}
|
||||
|
||||
public string MacSshUsername
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("MacSshUsername", "root");
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SetValue("MacSshUsername", value);
|
||||
}
|
||||
}
|
||||
|
||||
public string MacSshPassword
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConfigurationContext.DeobsfucateValue(this.GetValue("MacSshPassword", string.Empty));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SetValue("MacSshPassword", ConfigurationContext.ObsfucateValue(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,86 +1,86 @@
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Disco.Models.Repository;
|
||||
|
||||
//namespace Disco.Data.Configuration.Modules
|
||||
//{
|
||||
// public class DeviceProfileConfiguration : ConfigurationBase
|
||||
// {
|
||||
// private DeviceProfilesConfiguration deviceProfilesConfig;
|
||||
// private DeviceProfile deviceProfile;
|
||||
|
||||
// public DeviceProfileConfiguration(ConfigurationContext Context, DeviceProfile DeviceProfile)
|
||||
// : base(Context)
|
||||
// {
|
||||
// this.deviceProfilesConfig = Context.DeviceProfiles;
|
||||
// this.deviceProfile = DeviceProfile;
|
||||
// }
|
||||
|
||||
// public override string Scope
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return string.Format("DeviceProfile:{0}", this.deviceProfile.Id);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public string ComputerNameTemplate
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return this.GetValue("ComputerNameTemplate", "DeviceProfile.ShortName + '-' + SerialNumber");
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// this.SetValue("ComputerNameTemplate", value);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public enum DeviceProfileDistributionTypes : int
|
||||
// {
|
||||
// OneToMany = 0,
|
||||
// OneToOne = 1
|
||||
// }
|
||||
// public DeviceProfileDistributionTypes DistributionType
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return (DeviceProfileDistributionTypes)this.GetValue("DistributionType", (int)DeviceProfileDistributionTypes.OneToMany);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// this.SetValue("DistributionType", (int)value);
|
||||
// }
|
||||
// }
|
||||
// public string OrganisationalUnit
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return this.GetValue<string>("OrganisationalUnit", null);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// this.SetValue("OrganisationalUnit", value);
|
||||
// }
|
||||
// }
|
||||
// public bool AllocateWirelessCertificate
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return this.GetValue("AllocateWirelessCertificate", false);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// this.SetValue("AllocateWirelessCertificate", value);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
//}
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Disco.Models.Repository;
|
||||
|
||||
//namespace Disco.Data.Configuration.Modules
|
||||
//{
|
||||
// public class DeviceProfileConfiguration : ConfigurationBase
|
||||
// {
|
||||
// private DeviceProfilesConfiguration deviceProfilesConfig;
|
||||
// private DeviceProfile deviceProfile;
|
||||
|
||||
// public DeviceProfileConfiguration(ConfigurationContext Context, DeviceProfile DeviceProfile)
|
||||
// : base(Context)
|
||||
// {
|
||||
// this.deviceProfilesConfig = Context.DeviceProfiles;
|
||||
// this.deviceProfile = DeviceProfile;
|
||||
// }
|
||||
|
||||
// public override string Scope
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return string.Format("DeviceProfile:{0}", this.deviceProfile.Id);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public string ComputerNameTemplate
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return this.GetValue("ComputerNameTemplate", "DeviceProfile.ShortName + '-' + SerialNumber");
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// this.SetValue("ComputerNameTemplate", value);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public enum DeviceProfileDistributionTypes : int
|
||||
// {
|
||||
// OneToMany = 0,
|
||||
// OneToOne = 1
|
||||
// }
|
||||
// public DeviceProfileDistributionTypes DistributionType
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return (DeviceProfileDistributionTypes)this.GetValue("DistributionType", (int)DeviceProfileDistributionTypes.OneToMany);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// this.SetValue("DistributionType", (int)value);
|
||||
// }
|
||||
// }
|
||||
// public string OrganisationalUnit
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return this.GetValue<string>("OrganisationalUnit", null);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// this.SetValue("OrganisationalUnit", value);
|
||||
// }
|
||||
// }
|
||||
// public bool AllocateWirelessCertificate
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return this.GetValue("AllocateWirelessCertificate", false);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// this.SetValue("AllocateWirelessCertificate", value);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,70 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
public class DeviceProfilesConfiguration : ConfigurationBase
|
||||
{
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//private Dictionary<int, DeviceProfileConfiguration> deviceProfileConfigurations;
|
||||
|
||||
public DeviceProfilesConfiguration(ConfigurationContext Context)
|
||||
: base(Context)
|
||||
{
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//this.deviceProfileConfigurations = new Dictionary<int, DeviceProfileConfiguration>();
|
||||
}
|
||||
|
||||
public override string Scope
|
||||
{
|
||||
get { return "DeviceProfiles"; }
|
||||
}
|
||||
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//public DeviceProfileConfiguration DeviceProfile(DeviceProfile Profile)
|
||||
//{
|
||||
// DeviceProfileConfiguration dpc = default(DeviceProfileConfiguration);
|
||||
// if (!this.deviceProfileConfigurations.TryGetValue(Profile.Id, out dpc))
|
||||
// {
|
||||
// dpc = new DeviceProfileConfiguration(this.Context, Profile);
|
||||
// this.deviceProfileConfigurations[Profile.Id] = dpc;
|
||||
// }
|
||||
// return dpc;
|
||||
//}
|
||||
|
||||
public int DefaultDeviceProfileId
|
||||
{
|
||||
get
|
||||
{
|
||||
var v = this.GetValue("DefaultDeviceProfileId", 1);
|
||||
if (v > 0)
|
||||
return v;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 1)
|
||||
throw new ArgumentOutOfRangeException("value", "Expected >= 1");
|
||||
this.SetValue("DefaultDeviceProfileId", value);
|
||||
}
|
||||
}
|
||||
public int DefaultAddDeviceOfflineDeviceProfileId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("DefaultAddDeviceOfflineDeviceProfileId", 0);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
throw new ArgumentOutOfRangeException("value", "Expected >= 0");
|
||||
this.SetValue("DefaultAddDeviceOfflineDeviceProfileId", value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
public class DeviceProfilesConfiguration : ConfigurationBase
|
||||
{
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//private Dictionary<int, DeviceProfileConfiguration> deviceProfileConfigurations;
|
||||
|
||||
public DeviceProfilesConfiguration(ConfigurationContext Context)
|
||||
: base(Context)
|
||||
{
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//this.deviceProfileConfigurations = new Dictionary<int, DeviceProfileConfiguration>();
|
||||
}
|
||||
|
||||
public override string Scope
|
||||
{
|
||||
get { return "DeviceProfiles"; }
|
||||
}
|
||||
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//public DeviceProfileConfiguration DeviceProfile(DeviceProfile Profile)
|
||||
//{
|
||||
// DeviceProfileConfiguration dpc = default(DeviceProfileConfiguration);
|
||||
// if (!this.deviceProfileConfigurations.TryGetValue(Profile.Id, out dpc))
|
||||
// {
|
||||
// dpc = new DeviceProfileConfiguration(this.Context, Profile);
|
||||
// this.deviceProfileConfigurations[Profile.Id] = dpc;
|
||||
// }
|
||||
// return dpc;
|
||||
//}
|
||||
|
||||
public int DefaultDeviceProfileId
|
||||
{
|
||||
get
|
||||
{
|
||||
var v = this.GetValue("DefaultDeviceProfileId", 1);
|
||||
if (v > 0)
|
||||
return v;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 1)
|
||||
throw new ArgumentOutOfRangeException("value", "Expected >= 1");
|
||||
this.SetValue("DefaultDeviceProfileId", value);
|
||||
}
|
||||
}
|
||||
public int DefaultAddDeviceOfflineDeviceProfileId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("DefaultAddDeviceOfflineDeviceProfileId", 0);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
throw new ArgumentOutOfRangeException("value", "Expected >= 0");
|
||||
this.SetValue("DefaultAddDeviceOfflineDeviceProfileId", value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,89 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.BI.Config;
|
||||
using Disco.Models.Repository;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
public class OrganisationAddressesConfiguration : ConfigurationBase
|
||||
{
|
||||
public OrganisationAddressesConfiguration(ConfigurationContext Context) : base(Context) { }
|
||||
|
||||
public override string Scope
|
||||
{
|
||||
get { return "OrganisationAddresses"; }
|
||||
}
|
||||
|
||||
public OrganisationAddress GetAddress(int Id)
|
||||
{
|
||||
var address = default(OrganisationAddress);
|
||||
var addressString = this.GetValue<string>(Id.ToString(), null);
|
||||
if (addressString != null)
|
||||
{
|
||||
if (addressString.StartsWith("{"))
|
||||
{
|
||||
// Assume Json
|
||||
address = JsonConvert.DeserializeObject<OrganisationAddress>(addressString);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume Old Storage Method
|
||||
address = OrganisationAddress.FromConfigurationEntry(Id, addressString);
|
||||
}
|
||||
}
|
||||
return address;
|
||||
}
|
||||
public OrganisationAddress SetAddress(OrganisationAddress Address)
|
||||
{
|
||||
if (!Address.Id.HasValue)
|
||||
{
|
||||
Address.Id = NextOrganisationAddressId;
|
||||
}
|
||||
|
||||
string addressString = JsonConvert.SerializeObject(Address);
|
||||
|
||||
this.SetValue(Address.Id.ToString(), addressString); //Address.ToConfigurationEntry());
|
||||
return Address;
|
||||
}
|
||||
public void RemoveAddress(int Id)
|
||||
{
|
||||
// Set Config Item to null = Remove Configuration Item
|
||||
this.SetValue<string>(Id.ToString(), null);
|
||||
}
|
||||
|
||||
public List<OrganisationAddress> Addresses
|
||||
{
|
||||
get
|
||||
{
|
||||
Dictionary<string, ConfigurationItem> configAddress = default(Dictionary<string, ConfigurationItem>);
|
||||
if (this.Context.ConfigurationDictionary(this.Scope).TryGetValue(this.Scope, out configAddress))
|
||||
return configAddress.Select(
|
||||
ca => ca.Value.Value.StartsWith("{") ?
|
||||
JsonConvert.DeserializeObject<OrganisationAddress>(ca.Value.Value) :
|
||||
OrganisationAddress.FromConfigurationEntry(int.Parse(ca.Key), ca.Value.Value)
|
||||
).ToList();
|
||||
else
|
||||
return new List<OrganisationAddress>(); // Empty List - No Addresses
|
||||
}
|
||||
}
|
||||
|
||||
private int NextOrganisationAddressId
|
||||
{
|
||||
get
|
||||
{
|
||||
int nextId = 0;
|
||||
while (true)
|
||||
{
|
||||
if (this.Context.ConfigurationItem(this.Scope, nextId.ToString()) == null)
|
||||
break;
|
||||
nextId++;
|
||||
}
|
||||
return nextId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.BI.Config;
|
||||
using Disco.Models.Repository;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
public class OrganisationAddressesConfiguration : ConfigurationBase
|
||||
{
|
||||
public OrganisationAddressesConfiguration(ConfigurationContext Context) : base(Context) { }
|
||||
|
||||
public override string Scope
|
||||
{
|
||||
get { return "OrganisationAddresses"; }
|
||||
}
|
||||
|
||||
public OrganisationAddress GetAddress(int Id)
|
||||
{
|
||||
var address = default(OrganisationAddress);
|
||||
var addressString = this.GetValue<string>(Id.ToString(), null);
|
||||
if (addressString != null)
|
||||
{
|
||||
if (addressString.StartsWith("{"))
|
||||
{
|
||||
// Assume Json
|
||||
address = JsonConvert.DeserializeObject<OrganisationAddress>(addressString);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume Old Storage Method
|
||||
address = OrganisationAddress.FromConfigurationEntry(Id, addressString);
|
||||
}
|
||||
}
|
||||
return address;
|
||||
}
|
||||
public OrganisationAddress SetAddress(OrganisationAddress Address)
|
||||
{
|
||||
if (!Address.Id.HasValue)
|
||||
{
|
||||
Address.Id = NextOrganisationAddressId;
|
||||
}
|
||||
|
||||
string addressString = JsonConvert.SerializeObject(Address);
|
||||
|
||||
this.SetValue(Address.Id.ToString(), addressString); //Address.ToConfigurationEntry());
|
||||
return Address;
|
||||
}
|
||||
public void RemoveAddress(int Id)
|
||||
{
|
||||
// Set Config Item to null = Remove Configuration Item
|
||||
this.SetValue<string>(Id.ToString(), null);
|
||||
}
|
||||
|
||||
public List<OrganisationAddress> Addresses
|
||||
{
|
||||
get
|
||||
{
|
||||
Dictionary<string, ConfigurationItem> configAddress = default(Dictionary<string, ConfigurationItem>);
|
||||
if (this.Context.ConfigurationDictionary(this.Scope).TryGetValue(this.Scope, out configAddress))
|
||||
return configAddress.Select(
|
||||
ca => ca.Value.Value.StartsWith("{") ?
|
||||
JsonConvert.DeserializeObject<OrganisationAddress>(ca.Value.Value) :
|
||||
OrganisationAddress.FromConfigurationEntry(int.Parse(ca.Key), ca.Value.Value)
|
||||
).ToList();
|
||||
else
|
||||
return new List<OrganisationAddress>(); // Empty List - No Addresses
|
||||
}
|
||||
}
|
||||
|
||||
private int NextOrganisationAddressId
|
||||
{
|
||||
get
|
||||
{
|
||||
int nextId = 0;
|
||||
while (true)
|
||||
{
|
||||
if (this.Context.ConfigurationItem(this.Scope, nextId.ToString()) == null)
|
||||
break;
|
||||
nextId++;
|
||||
}
|
||||
return nextId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,109 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
public class WirelessConfiguration : ConfigurationBase
|
||||
{
|
||||
public const string Provider_eduSTAR = "eduSTAR";
|
||||
public const string Provider_eduPaSS = "eduPaSS";
|
||||
|
||||
public WirelessConfiguration(ConfigurationContext Context) : base(Context) { }
|
||||
|
||||
public override string Scope
|
||||
{
|
||||
get { return "Wireless"; }
|
||||
}
|
||||
|
||||
public int CertificateAutoBufferMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("CertificateAutoBufferMax", 50);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SetValue("CertificateAutoBufferMax", value);
|
||||
}
|
||||
}
|
||||
public int CertificateAutoBufferLow
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("CertificateAutoBufferLow", 10);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SetValue("CertificateAutoBufferLow", value);
|
||||
}
|
||||
}
|
||||
public string Provider
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("Provider", Provider_eduSTAR);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
throw new ArgumentNullException("value");
|
||||
if (value.Equals(Provider_eduSTAR, StringComparison.InvariantCultureIgnoreCase))
|
||||
this.SetValue("Provider", Provider_eduSTAR);
|
||||
else
|
||||
throw new NotSupportedException(string.Format("Unsupported Wireless Provider: ", value));
|
||||
}
|
||||
}
|
||||
|
||||
#region eduSTAR Configuration
|
||||
|
||||
public string eduSTAR_Scope
|
||||
{
|
||||
get { return "Wireless_eduSTAR"; }
|
||||
}
|
||||
|
||||
public string eduSTAR_ServiceAccountSchoolId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountSchoolId", null);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
throw new ArgumentNullException("value");
|
||||
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountSchoolId", value);
|
||||
}
|
||||
}
|
||||
public string eduSTAR_ServiceAccountUsername
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountUsername", null);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
throw new ArgumentNullException("value");
|
||||
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountUsername", value);
|
||||
}
|
||||
}
|
||||
public string eduSTAR_ServiceAccountPassword
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConfigurationContext.DeobsfucateValue(this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountPassword", null));
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
throw new ArgumentNullException("value");
|
||||
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountPassword", ConfigurationContext.ObsfucateValue(value));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
public class WirelessConfiguration : ConfigurationBase
|
||||
{
|
||||
public const string Provider_eduSTAR = "eduSTAR";
|
||||
public const string Provider_eduPaSS = "eduPaSS";
|
||||
|
||||
public WirelessConfiguration(ConfigurationContext Context) : base(Context) { }
|
||||
|
||||
public override string Scope
|
||||
{
|
||||
get { return "Wireless"; }
|
||||
}
|
||||
|
||||
public int CertificateAutoBufferMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("CertificateAutoBufferMax", 50);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SetValue("CertificateAutoBufferMax", value);
|
||||
}
|
||||
}
|
||||
public int CertificateAutoBufferLow
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("CertificateAutoBufferLow", 10);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SetValue("CertificateAutoBufferLow", value);
|
||||
}
|
||||
}
|
||||
public string Provider
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue("Provider", Provider_eduSTAR);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
throw new ArgumentNullException("value");
|
||||
if (value.Equals(Provider_eduSTAR, StringComparison.InvariantCultureIgnoreCase))
|
||||
this.SetValue("Provider", Provider_eduSTAR);
|
||||
else
|
||||
throw new NotSupportedException(string.Format("Unsupported Wireless Provider: ", value));
|
||||
}
|
||||
}
|
||||
|
||||
#region eduSTAR Configuration
|
||||
|
||||
public string eduSTAR_Scope
|
||||
{
|
||||
get { return "Wireless_eduSTAR"; }
|
||||
}
|
||||
|
||||
public string eduSTAR_ServiceAccountSchoolId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountSchoolId", null);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
throw new ArgumentNullException("value");
|
||||
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountSchoolId", value);
|
||||
}
|
||||
}
|
||||
public string eduSTAR_ServiceAccountUsername
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountUsername", null);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
throw new ArgumentNullException("value");
|
||||
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountUsername", value);
|
||||
}
|
||||
}
|
||||
public string eduSTAR_ServiceAccountPassword
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConfigurationContext.DeobsfucateValue(this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountPassword", null));
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
throw new ArgumentNullException("value");
|
||||
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountPassword", ConfigurationContext.ObsfucateValue(value));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+20
-20
@@ -1,20 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Disco.Data", "Disco.Data.csproj", "{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Disco.Data", "Disco.Data.csproj", "{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{85A6BD19-2C64-4746-8F2C-A68A86E8C2D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
+24
-24
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+24
-24
File diff suppressed because one or more lines are too long
@@ -1,25 +1,25 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv1 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DocumentTemplates", "FlattenForm", c => c.Boolean(nullable: false, defaultValue: false));
|
||||
AddColumn("JobMetaNonWarranties", "AccountingChargeRequiredDate", c => c.DateTime());
|
||||
AddColumn("JobMetaNonWarranties", "AccountingChargeRequiredUserId", c => c.String(maxLength: 50));
|
||||
AddForeignKey("JobMetaNonWarranties", "AccountingChargeRequiredUserId", "Users", "Id");
|
||||
CreateIndex("JobMetaNonWarranties", "AccountingChargeRequiredUserId");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("JobMetaNonWarranties", new[] { "AccountingChargeRequiredUserId" });
|
||||
DropForeignKey("JobMetaNonWarranties", "AccountingChargeRequiredUserId", "Users");
|
||||
DropColumn("JobMetaNonWarranties", "AccountingChargeRequiredUserId");
|
||||
DropColumn("JobMetaNonWarranties", "AccountingChargeRequiredDate");
|
||||
DropColumn("DocumentTemplates", "FlattenForm");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv1 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DocumentTemplates", "FlattenForm", c => c.Boolean(nullable: false, defaultValue: false));
|
||||
AddColumn("JobMetaNonWarranties", "AccountingChargeRequiredDate", c => c.DateTime());
|
||||
AddColumn("JobMetaNonWarranties", "AccountingChargeRequiredUserId", c => c.String(maxLength: 50));
|
||||
AddForeignKey("JobMetaNonWarranties", "AccountingChargeRequiredUserId", "Users", "Id");
|
||||
CreateIndex("JobMetaNonWarranties", "AccountingChargeRequiredUserId");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("JobMetaNonWarranties", new[] { "AccountingChargeRequiredUserId" });
|
||||
DropForeignKey("JobMetaNonWarranties", "AccountingChargeRequiredUserId", "Users");
|
||||
DropColumn("JobMetaNonWarranties", "AccountingChargeRequiredUserId");
|
||||
DropColumn("JobMetaNonWarranties", "AccountingChargeRequiredDate");
|
||||
DropColumn("DocumentTemplates", "FlattenForm");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
File diff suppressed because one or more lines are too long
@@ -1,17 +1,17 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv2 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("Jobs", "Flags", c => c.Long());
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("Jobs", "Flags");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv2 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("Jobs", "Flags", c => c.Long());
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("Jobs", "Flags");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
File diff suppressed because one or more lines are too long
@@ -1,30 +1,30 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv3 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "ComputerNameTemplate", c => c.String(nullable: true));
|
||||
Sql(@"UPDATE DeviceProfiles SET ComputerNameTemplate='DeviceProfile.ShortName + ''-'' + SerialNumber'");
|
||||
AlterColumn("DeviceProfiles", "ComputerNameTemplate", c => c.String(nullable: false));
|
||||
|
||||
AddColumn("DeviceProfiles", "DistributionType", c => c.Int(nullable: false));
|
||||
AddColumn("DeviceProfiles", "OrganisationalUnit", c => c.String());
|
||||
AddColumn("DeviceProfiles", "AllocateWirelessCertificate", c => c.Boolean(nullable: false));
|
||||
AddColumn("DeviceProfiles", "EnforceComputerNameConvention", c => c.Boolean(nullable: false));
|
||||
AddColumn("DeviceProfiles", "EnforceOrganisationalUnit", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("DeviceProfiles", "EnforceOrganisationalUnit");
|
||||
DropColumn("DeviceProfiles", "EnforceComputerNameConvention");
|
||||
DropColumn("DeviceProfiles", "AllocateWirelessCertificate");
|
||||
DropColumn("DeviceProfiles", "OrganisationalUnit");
|
||||
DropColumn("DeviceProfiles", "DistributionType");
|
||||
DropColumn("DeviceProfiles", "ComputerNameTemplate");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv3 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "ComputerNameTemplate", c => c.String(nullable: true));
|
||||
Sql(@"UPDATE DeviceProfiles SET ComputerNameTemplate='DeviceProfile.ShortName + ''-'' + SerialNumber'");
|
||||
AlterColumn("DeviceProfiles", "ComputerNameTemplate", c => c.String(nullable: false));
|
||||
|
||||
AddColumn("DeviceProfiles", "DistributionType", c => c.Int(nullable: false));
|
||||
AddColumn("DeviceProfiles", "OrganisationalUnit", c => c.String());
|
||||
AddColumn("DeviceProfiles", "AllocateWirelessCertificate", c => c.Boolean(nullable: false));
|
||||
AddColumn("DeviceProfiles", "EnforceComputerNameConvention", c => c.Boolean(nullable: false));
|
||||
AddColumn("DeviceProfiles", "EnforceOrganisationalUnit", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("DeviceProfiles", "EnforceOrganisationalUnit");
|
||||
DropColumn("DeviceProfiles", "EnforceComputerNameConvention");
|
||||
DropColumn("DeviceProfiles", "AllocateWirelessCertificate");
|
||||
DropColumn("DeviceProfiles", "OrganisationalUnit");
|
||||
DropColumn("DeviceProfiles", "DistributionType");
|
||||
DropColumn("DeviceProfiles", "ComputerNameTemplate");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
File diff suppressed because one or more lines are too long
@@ -1,52 +1,52 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv4 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "ProvisionADAccount", c => c.Boolean(nullable: false));
|
||||
Sql(@"UPDATE [DeviceProfiles] SET [ProvisionADAccount]=1;");
|
||||
|
||||
DropColumn("Devices", "CertificateStoreReference");
|
||||
|
||||
RenameTable(name: "WirelessCertificates", newName: "DeviceCertificates");
|
||||
AddColumn("DeviceCertificates", "ProviderId", c => c.String(maxLength: 64));
|
||||
RenameColumn("DeviceCertificates", "Index", "ProviderIndex");
|
||||
Sql("UPDATE DeviceCertificates SET ProviderId='EduSTARnetCertificateProvider'");
|
||||
AlterColumn("DeviceCertificates", "ProviderId", c => c.String(nullable: false, maxLength: 64));
|
||||
|
||||
//RenameColumn("DeviceProfiles", "AllocateWirelessCertificate", "AllocateCertificate");
|
||||
AddColumn("DeviceProfiles", "CertificateProviderId", c => c.String(maxLength: 64));
|
||||
Sql(@"UPDATE [DeviceProfiles] SET [CertificateProviderId]='EduSTARnetCertificateProvider' WHERE [AllocateWirelessCertificate]=1;");
|
||||
|
||||
// Migrate eduSTAR.net Configuration
|
||||
Sql(@"UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='AutoBufferMin' WHERE [Scope]='Wireless' AND [Key]='CertificateAutoBufferLow';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='AutoBufferMax' WHERE [Scope]='Wireless' AND [Key]='CertificateAutoBufferMax';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='ServicePassword' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountPassword';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='SchoolId' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountSchoolId';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='ServiceUsername' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountUsername';"
|
||||
);
|
||||
|
||||
Sql(@"UPDATE [DeviceModels] SET [DefaultWarrantyProvider]='LWTWarrantyProvider' WHERE [DefaultWarrantyProvider]='LWT';");
|
||||
|
||||
DropColumn("DeviceProfiles", "AllocateWirelessCertificate");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "AllocateWirelessCertificate", c => c.Boolean(nullable: false));
|
||||
|
||||
RenameColumn("DeviceCertificates", "ProviderIndex", "Index");
|
||||
DropColumn("DeviceCertificates", "ProviderId");
|
||||
RenameTable(name: "DeviceCertificates", newName: "WirelessCertificates");
|
||||
|
||||
DropColumn("DeviceProfiles", "CertificateProviderId");
|
||||
|
||||
AddColumn("Devices", "CertificateStoreReference", c => c.String(maxLength: 24));
|
||||
|
||||
DropColumn("DeviceProfiles", "ProvisionADAccount");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv4 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "ProvisionADAccount", c => c.Boolean(nullable: false));
|
||||
Sql(@"UPDATE [DeviceProfiles] SET [ProvisionADAccount]=1;");
|
||||
|
||||
DropColumn("Devices", "CertificateStoreReference");
|
||||
|
||||
RenameTable(name: "WirelessCertificates", newName: "DeviceCertificates");
|
||||
AddColumn("DeviceCertificates", "ProviderId", c => c.String(maxLength: 64));
|
||||
RenameColumn("DeviceCertificates", "Index", "ProviderIndex");
|
||||
Sql("UPDATE DeviceCertificates SET ProviderId='EduSTARnetCertificateProvider'");
|
||||
AlterColumn("DeviceCertificates", "ProviderId", c => c.String(nullable: false, maxLength: 64));
|
||||
|
||||
//RenameColumn("DeviceProfiles", "AllocateWirelessCertificate", "AllocateCertificate");
|
||||
AddColumn("DeviceProfiles", "CertificateProviderId", c => c.String(maxLength: 64));
|
||||
Sql(@"UPDATE [DeviceProfiles] SET [CertificateProviderId]='EduSTARnetCertificateProvider' WHERE [AllocateWirelessCertificate]=1;");
|
||||
|
||||
// Migrate eduSTAR.net Configuration
|
||||
Sql(@"UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='AutoBufferMin' WHERE [Scope]='Wireless' AND [Key]='CertificateAutoBufferLow';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='AutoBufferMax' WHERE [Scope]='Wireless' AND [Key]='CertificateAutoBufferMax';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='ServicePassword' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountPassword';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='SchoolId' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountSchoolId';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='ServiceUsername' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountUsername';"
|
||||
);
|
||||
|
||||
Sql(@"UPDATE [DeviceModels] SET [DefaultWarrantyProvider]='LWTWarrantyProvider' WHERE [DefaultWarrantyProvider]='LWT';");
|
||||
|
||||
DropColumn("DeviceProfiles", "AllocateWirelessCertificate");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "AllocateWirelessCertificate", c => c.Boolean(nullable: false));
|
||||
|
||||
RenameColumn("DeviceCertificates", "ProviderIndex", "Index");
|
||||
DropColumn("DeviceCertificates", "ProviderId");
|
||||
RenameTable(name: "DeviceCertificates", newName: "WirelessCertificates");
|
||||
|
||||
DropColumn("DeviceProfiles", "CertificateProviderId");
|
||||
|
||||
AddColumn("Devices", "CertificateStoreReference", c => c.String(maxLength: 24));
|
||||
|
||||
DropColumn("DeviceProfiles", "ProvisionADAccount");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
-27
@@ -1,27 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv5 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv5));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201211090325116_DBv5"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv5 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv5));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201211090325116_DBv5"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +1,96 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv5 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
// Drop Foreign Keys
|
||||
|
||||
// 2012-11-09 - G#
|
||||
// ForeignKey Names are not consistant among databases - Especially version 4.3.1 -> 5.0.0.net45
|
||||
#region "Support inconsistant foreign key names"
|
||||
// DeviceCertificates was renamed from WirelessCertificates
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceCertificates] DROP CONSTRAINT [FK_dbo.DeviceCertificates_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceCertificates] DROP CONSTRAINT [FK_WirelessCertificates_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceAttachments
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceAttachments] DROP CONSTRAINT [FK_dbo.DeviceAttachments_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceAttachments] DROP CONSTRAINT [FK_DeviceAttachments_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceDetails
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceDetails] DROP CONSTRAINT [FK_dbo.DeviceDetails_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceDetails] DROP CONSTRAINT [FK_DeviceDetails_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// Jobs
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[Jobs] DROP CONSTRAINT [FK_dbo.Jobs_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[Jobs] DROP CONSTRAINT [FK_Jobs_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceUserAssignments
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceUserAssignments] DROP CONSTRAINT [FK_dbo.DeviceUserAssignments_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceUserAssignments] DROP CONSTRAINT [FK_DeviceUserAssignments_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
#endregion
|
||||
|
||||
AlterColumn("dbo.Devices", "SerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.DeviceUserAssignments", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.Jobs", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
AlterColumn("dbo.DeviceDetails", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.DeviceAttachments", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
AlterColumn("dbo.DeviceCertificates", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
|
||||
// Re-create Foreign Keys
|
||||
AddForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
// Drop Foreign Keys
|
||||
DropForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
|
||||
AlterColumn("dbo.DeviceCertificates", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceAttachments", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceDetails", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
AlterColumn("dbo.Jobs", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceUserAssignments", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
AlterColumn("dbo.Devices", "SerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
|
||||
// Re-create Foreign Keys
|
||||
AddForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv5 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
// Drop Foreign Keys
|
||||
|
||||
// 2012-11-09 - G#
|
||||
// ForeignKey Names are not consistant among databases - Especially version 4.3.1 -> 5.0.0.net45
|
||||
#region "Support inconsistant foreign key names"
|
||||
// DeviceCertificates was renamed from WirelessCertificates
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceCertificates] DROP CONSTRAINT [FK_dbo.DeviceCertificates_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceCertificates] DROP CONSTRAINT [FK_WirelessCertificates_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceAttachments
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceAttachments] DROP CONSTRAINT [FK_dbo.DeviceAttachments_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceAttachments] DROP CONSTRAINT [FK_DeviceAttachments_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceDetails
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceDetails] DROP CONSTRAINT [FK_dbo.DeviceDetails_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceDetails] DROP CONSTRAINT [FK_DeviceDetails_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// Jobs
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[Jobs] DROP CONSTRAINT [FK_dbo.Jobs_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[Jobs] DROP CONSTRAINT [FK_Jobs_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceUserAssignments
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceUserAssignments] DROP CONSTRAINT [FK_dbo.DeviceUserAssignments_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceUserAssignments] DROP CONSTRAINT [FK_DeviceUserAssignments_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
#endregion
|
||||
|
||||
AlterColumn("dbo.Devices", "SerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.DeviceUserAssignments", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.Jobs", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
AlterColumn("dbo.DeviceDetails", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.DeviceAttachments", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
AlterColumn("dbo.DeviceCertificates", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
|
||||
// Re-create Foreign Keys
|
||||
AddForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
// Drop Foreign Keys
|
||||
DropForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
|
||||
AlterColumn("dbo.DeviceCertificates", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceAttachments", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceDetails", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
AlterColumn("dbo.Jobs", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceUserAssignments", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
AlterColumn("dbo.Devices", "SerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
|
||||
// Re-create Foreign Keys
|
||||
AddForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
+27
-27
@@ -1,27 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv6 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv6));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201301150107063_DBv6"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv6 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv6));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201301150107063_DBv6"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv6 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
DropColumn("dbo.DeviceModels", "Image");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.DeviceModels", "Image", c => c.Binary());
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv6 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
DropColumn("dbo.DeviceModels", "Image");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.DeviceModels", "Image", c => c.Binary());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,21 +1,21 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Linq;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
internal sealed class Configuration : DbMigrationsConfiguration<DiscoDataContext>
|
||||
{
|
||||
public Configuration()
|
||||
{
|
||||
AutomaticMigrationsEnabled = false;
|
||||
}
|
||||
|
||||
protected override void Seed(DiscoDataContext context)
|
||||
{
|
||||
context.SeedDatabase();
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Linq;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
internal sealed class Configuration : DbMigrationsConfiguration<DiscoDataContext>
|
||||
{
|
||||
public Configuration()
|
||||
{
|
||||
AutomaticMigrationsEnabled = false;
|
||||
}
|
||||
|
||||
protected override void Seed(DiscoDataContext context)
|
||||
{
|
||||
context.SeedDatabase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
public static class DiscoDataMigrator
|
||||
{
|
||||
|
||||
private static DbMigrator GetMigrator()
|
||||
{
|
||||
var migContext = new DbMigrationsConfiguration<DiscoDataContext>();
|
||||
migContext.MigrationsAssembly = typeof(DiscoDataMigrator).Assembly;
|
||||
migContext.MigrationsNamespace = "Disco.Data.Migrations";
|
||||
|
||||
return new DbMigrator(migContext);
|
||||
}
|
||||
|
||||
public static void MigrateLatest(bool Seed)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
migrator.Update();
|
||||
|
||||
if (Seed)
|
||||
SeedDatabase();
|
||||
}
|
||||
public static void ForceMigration(string TargetMigration, bool Seed)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
migrator.Update(TargetMigration);
|
||||
|
||||
if (Seed)
|
||||
SeedDatabase();
|
||||
}
|
||||
|
||||
public static string MigrationScript(string CurrentMigration, string TargetMigration)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
var scriptor = new MigratorScriptingDecorator(migrator);
|
||||
return scriptor.ScriptUpdate(CurrentMigration, TargetMigration);
|
||||
}
|
||||
|
||||
public static void SeedDatabase()
|
||||
{
|
||||
// Seed/Update Database
|
||||
using (DiscoDataContext dbContext = new DiscoDataContext())
|
||||
{
|
||||
dbContext.SeedDatabase();
|
||||
try
|
||||
{
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static MigrationStatus Status()
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
var appliedMigrations = migrator.GetDatabaseMigrations().ToList();
|
||||
var pendingMigrations = migrator.GetPendingMigrations().ToList();
|
||||
var currentMigration = appliedMigrations.LastOrDefault();
|
||||
|
||||
return new MigrationStatus()
|
||||
{
|
||||
CurrentMigration = currentMigration,
|
||||
AppliedMigrations = appliedMigrations,
|
||||
PendingMigrations = pendingMigrations,
|
||||
AllMigrations = appliedMigrations.Union(pendingMigrations)
|
||||
};
|
||||
}
|
||||
|
||||
public class MigrationStatus
|
||||
{
|
||||
public string CurrentMigration { get; internal set; }
|
||||
public IEnumerable<string> AppliedMigrations { get; internal set; }
|
||||
public IEnumerable<string> PendingMigrations { get; internal set; }
|
||||
public IEnumerable<string> AllMigrations { get; internal set; }
|
||||
|
||||
internal MigrationStatus()
|
||||
{
|
||||
// Private Constructor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
public static class DiscoDataMigrator
|
||||
{
|
||||
|
||||
private static DbMigrator GetMigrator()
|
||||
{
|
||||
var migContext = new DbMigrationsConfiguration<DiscoDataContext>();
|
||||
migContext.MigrationsAssembly = typeof(DiscoDataMigrator).Assembly;
|
||||
migContext.MigrationsNamespace = "Disco.Data.Migrations";
|
||||
|
||||
return new DbMigrator(migContext);
|
||||
}
|
||||
|
||||
public static void MigrateLatest(bool Seed)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
migrator.Update();
|
||||
|
||||
if (Seed)
|
||||
SeedDatabase();
|
||||
}
|
||||
public static void ForceMigration(string TargetMigration, bool Seed)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
migrator.Update(TargetMigration);
|
||||
|
||||
if (Seed)
|
||||
SeedDatabase();
|
||||
}
|
||||
|
||||
public static string MigrationScript(string CurrentMigration, string TargetMigration)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
var scriptor = new MigratorScriptingDecorator(migrator);
|
||||
return scriptor.ScriptUpdate(CurrentMigration, TargetMigration);
|
||||
}
|
||||
|
||||
public static void SeedDatabase()
|
||||
{
|
||||
// Seed/Update Database
|
||||
using (DiscoDataContext dbContext = new DiscoDataContext())
|
||||
{
|
||||
dbContext.SeedDatabase();
|
||||
try
|
||||
{
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static MigrationStatus Status()
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
var appliedMigrations = migrator.GetDatabaseMigrations().ToList();
|
||||
var pendingMigrations = migrator.GetPendingMigrations().ToList();
|
||||
var currentMigration = appliedMigrations.LastOrDefault();
|
||||
|
||||
return new MigrationStatus()
|
||||
{
|
||||
CurrentMigration = currentMigration,
|
||||
AppliedMigrations = appliedMigrations,
|
||||
PendingMigrations = pendingMigrations,
|
||||
AllMigrations = appliedMigrations.Union(pendingMigrations)
|
||||
};
|
||||
}
|
||||
|
||||
public class MigrationStatus
|
||||
{
|
||||
public string CurrentMigration { get; internal set; }
|
||||
public IEnumerable<string> AppliedMigrations { get; internal set; }
|
||||
public IEnumerable<string> PendingMigrations { get; internal set; }
|
||||
public IEnumerable<string> AllMigrations { get; internal set; }
|
||||
|
||||
internal MigrationStatus()
|
||||
{
|
||||
// Private Constructor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+73
-73
@@ -1,73 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Data.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Disco.Data.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] EmptyLogo {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("EmptyLogo", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Data.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Disco.Data.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] EmptyLogo {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("EmptyLogo", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,124 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="EmptyLogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\EmptyLogo.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="EmptyLogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\EmptyLogo.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,72 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.Entity;
|
||||
using Disco.Models.Repository;
|
||||
using System.Data.Entity.ModelConfiguration.Conventions;
|
||||
|
||||
namespace Disco.Data.Repository
|
||||
{
|
||||
public class DiscoDataContext : DbContext
|
||||
{
|
||||
private Lazy<Configuration.ConfigurationContext> _Configuration;
|
||||
|
||||
public DiscoDataContext()
|
||||
{
|
||||
this._Configuration = new Lazy<Configuration.ConfigurationContext>(() => new Configuration.ConfigurationContext(this));
|
||||
}
|
||||
|
||||
public virtual DbSet<ConfigurationItem> ConfigurationItems { get; set; }
|
||||
|
||||
public virtual DbSet<DocumentTemplate> DocumentTemplates { get; set; }
|
||||
|
||||
public virtual DbSet<User> Users { get; set; }
|
||||
public virtual DbSet<UserAttachment> UserAttachments { get; set; }
|
||||
|
||||
public virtual DbSet<DeviceUserAssignment> DeviceUserAssignments { get; set; }
|
||||
|
||||
public virtual DbSet<Device> Devices { get; set; }
|
||||
public virtual DbSet<DeviceDetail> DeviceDetails { get; set; }
|
||||
public virtual DbSet<DeviceModel> DeviceModels { get; set; }
|
||||
public virtual DbSet<DeviceProfile> DeviceProfiles { get; set; }
|
||||
public virtual DbSet<DeviceBatch> DeviceBatches { get; set; }
|
||||
public virtual DbSet<DeviceComponent> DeviceComponents { get; set; }
|
||||
public virtual DbSet<DeviceAttachment> DeviceAttachments { get; set; }
|
||||
|
||||
public virtual DbSet<DeviceCertificate> DeviceCertificates { get; set; }
|
||||
|
||||
public virtual DbSet<Job> Jobs { get; set; }
|
||||
public virtual DbSet<JobType> JobTypes { get; set; }
|
||||
public virtual DbSet<JobSubType> JobSubTypes { get; set; }
|
||||
public virtual DbSet<JobLog> JobLogs { get; set; }
|
||||
public virtual DbSet<JobAttachment> JobAttachments { get; set; }
|
||||
public virtual DbSet<JobComponent> JobComponents { get; set; }
|
||||
|
||||
public virtual DbSet<JobMetaWarranty> JobMetaWarranties { get; set; }
|
||||
public virtual DbSet<JobMetaNonWarranty> JobMetaNonWarranties { get; set; }
|
||||
public virtual DbSet<JobMetaInsurance> JobMetaInsurances { get; set; }
|
||||
|
||||
public Configuration.ConfigurationContext DiscoConfiguration
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Configuration.Value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
|
||||
|
||||
modelBuilder.Entity<DeviceComponent>().HasMany(m => m.JobSubTypes).WithMany(m => m.DeviceComponents).Map(m => m.ToTable("DeviceComponents_JobSubTypes"));
|
||||
modelBuilder.Entity<DocumentTemplate>().HasMany(m => m.JobSubTypes).WithMany(m => m.AttachmentTypes).Map(m => m.ToTable("DocumentTemplates_JobSubTypes"));
|
||||
|
||||
modelBuilder.Entity<Job>().HasMany(m => m.JobSubTypes).WithMany(m => m.Jobs).Map(m => m.ToTable("Jobs_JobSubTypes"));
|
||||
modelBuilder.Entity<User>().HasMany(m => m.Jobs).WithOptional(m => m.User);
|
||||
modelBuilder.Entity<Device>().HasMany(m => m.Jobs).WithOptional(m => m.Device);
|
||||
modelBuilder.Entity<DeviceProfile>().Property(DeviceProfile.PropertyAccessExpressions.DistributionTypeDb);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.Entity;
|
||||
using Disco.Models.Repository;
|
||||
using System.Data.Entity.ModelConfiguration.Conventions;
|
||||
|
||||
namespace Disco.Data.Repository
|
||||
{
|
||||
public class DiscoDataContext : DbContext
|
||||
{
|
||||
private Lazy<Configuration.ConfigurationContext> _Configuration;
|
||||
|
||||
public DiscoDataContext()
|
||||
{
|
||||
this._Configuration = new Lazy<Configuration.ConfigurationContext>(() => new Configuration.ConfigurationContext(this));
|
||||
}
|
||||
|
||||
public virtual DbSet<ConfigurationItem> ConfigurationItems { get; set; }
|
||||
|
||||
public virtual DbSet<DocumentTemplate> DocumentTemplates { get; set; }
|
||||
|
||||
public virtual DbSet<User> Users { get; set; }
|
||||
public virtual DbSet<UserAttachment> UserAttachments { get; set; }
|
||||
|
||||
public virtual DbSet<DeviceUserAssignment> DeviceUserAssignments { get; set; }
|
||||
|
||||
public virtual DbSet<Device> Devices { get; set; }
|
||||
public virtual DbSet<DeviceDetail> DeviceDetails { get; set; }
|
||||
public virtual DbSet<DeviceModel> DeviceModels { get; set; }
|
||||
public virtual DbSet<DeviceProfile> DeviceProfiles { get; set; }
|
||||
public virtual DbSet<DeviceBatch> DeviceBatches { get; set; }
|
||||
public virtual DbSet<DeviceComponent> DeviceComponents { get; set; }
|
||||
public virtual DbSet<DeviceAttachment> DeviceAttachments { get; set; }
|
||||
|
||||
public virtual DbSet<DeviceCertificate> DeviceCertificates { get; set; }
|
||||
|
||||
public virtual DbSet<Job> Jobs { get; set; }
|
||||
public virtual DbSet<JobType> JobTypes { get; set; }
|
||||
public virtual DbSet<JobSubType> JobSubTypes { get; set; }
|
||||
public virtual DbSet<JobLog> JobLogs { get; set; }
|
||||
public virtual DbSet<JobAttachment> JobAttachments { get; set; }
|
||||
public virtual DbSet<JobComponent> JobComponents { get; set; }
|
||||
|
||||
public virtual DbSet<JobMetaWarranty> JobMetaWarranties { get; set; }
|
||||
public virtual DbSet<JobMetaNonWarranty> JobMetaNonWarranties { get; set; }
|
||||
public virtual DbSet<JobMetaInsurance> JobMetaInsurances { get; set; }
|
||||
|
||||
public Configuration.ConfigurationContext DiscoConfiguration
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Configuration.Value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
|
||||
|
||||
modelBuilder.Entity<DeviceComponent>().HasMany(m => m.JobSubTypes).WithMany(m => m.DeviceComponents).Map(m => m.ToTable("DeviceComponents_JobSubTypes"));
|
||||
modelBuilder.Entity<DocumentTemplate>().HasMany(m => m.JobSubTypes).WithMany(m => m.AttachmentTypes).Map(m => m.ToTable("DocumentTemplates_JobSubTypes"));
|
||||
|
||||
modelBuilder.Entity<Job>().HasMany(m => m.JobSubTypes).WithMany(m => m.Jobs).Map(m => m.ToTable("Jobs_JobSubTypes"));
|
||||
modelBuilder.Entity<User>().HasMany(m => m.Jobs).WithOptional(m => m.User);
|
||||
modelBuilder.Entity<Device>().HasMany(m => m.Jobs).WithOptional(m => m.Device);
|
||||
modelBuilder.Entity<DeviceProfile>().Property(DeviceProfile.PropertyAccessExpressions.DistributionTypeDb);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
// Shouldn't Need this => Moved to Entity Migrations...
|
||||
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Data.Entity;
|
||||
|
||||
//namespace Disco.Data.Repository
|
||||
//{
|
||||
// class DiscoDataContextInitializer : CreateDatabaseIfNotExists<DiscoDataContext>
|
||||
// {
|
||||
// protected override void Seed(DiscoDataContext context)
|
||||
// {
|
||||
// context.SeedDatabase();
|
||||
// context.SaveChanges();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Shouldn't Need this => Moved to Entity Migrations...
|
||||
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Data.Entity;
|
||||
|
||||
//namespace Disco.Data.Repository
|
||||
//{
|
||||
// class DiscoDataContextInitializer : CreateDatabaseIfNotExists<DiscoDataContext>
|
||||
// {
|
||||
// protected override void Seed(DiscoDataContext context)
|
||||
// {
|
||||
// context.SeedDatabase();
|
||||
// context.SaveChanges();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,88 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
using Microsoft.Win32;
|
||||
using System.Data.Common;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace Disco.Data.Repository
|
||||
{
|
||||
public class DiscoDatabaseConnectionFactory : IDbConnectionFactory
|
||||
{
|
||||
private const string DiscoRegistryKey = @"SOFTWARE\Disco";
|
||||
|
||||
private IDbConnectionFactory DefaultConnectionFactory;
|
||||
private IDbConnectionFactory SqlCeConnectionFactory;
|
||||
private static string _DiscoDataContextConnectionString;
|
||||
|
||||
public static string DiscoDataContextConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DiscoDataContextConnectionString == null)
|
||||
{
|
||||
// Retrieve from Registry
|
||||
using (var key = Registry.LocalMachine.OpenSubKey(DiscoRegistryKey))
|
||||
{
|
||||
if (key != null)
|
||||
_DiscoDataContextConnectionString = (string)key.GetValue("DatabaseConnectionString", null);
|
||||
}
|
||||
}
|
||||
return _DiscoDataContextConnectionString;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDiscoDataContextConnectionString(string ConnectionString, bool Persist)
|
||||
{
|
||||
// Set to Local Cache
|
||||
_DiscoDataContextConnectionString = ConnectionString;
|
||||
|
||||
if (Persist)
|
||||
{
|
||||
// Set to Registry
|
||||
try
|
||||
{
|
||||
using (var key = Registry.LocalMachine.CreateSubKey(DiscoRegistryKey))
|
||||
{
|
||||
key.SetValue("DatabaseConnectionString", ConnectionString, RegistryValueKind.String);
|
||||
}
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
throw new SecurityException(string.Format("Unable to write to the Registry Location: HKML\\{0}[DatabaseConnectionString]", DiscoRegistryKey), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DiscoDatabaseConnectionFactory(IDbConnectionFactory Default)
|
||||
{
|
||||
this.DefaultConnectionFactory = Default;
|
||||
this.SqlCeConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
|
||||
}
|
||||
|
||||
public System.Data.Common.DbConnection CreateConnection(string nameOrConnectionString)
|
||||
{
|
||||
if (nameOrConnectionString == "Disco.Data.Repository.DiscoDataContext")
|
||||
{
|
||||
|
||||
var connectionString = DiscoDataContextConnectionString;
|
||||
if (connectionString == null)
|
||||
{
|
||||
throw new InvalidOperationException("The Disco DataContext Connection String has not been configured");
|
||||
}
|
||||
|
||||
// Build DiscoDataContext - Use Default Connection Factory (SQLClient)
|
||||
|
||||
//return this.DefaultConnectionFactory.CreateConnection(connectionString);
|
||||
var connection = DbProviderFactories.GetFactory("System.Data.SqlClient").CreateConnection();
|
||||
connection.ConnectionString = connectionString;
|
||||
return connection;
|
||||
}
|
||||
|
||||
return SqlCeConnectionFactory.CreateConnection(nameOrConnectionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
using Microsoft.Win32;
|
||||
using System.Data.Common;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace Disco.Data.Repository
|
||||
{
|
||||
public class DiscoDatabaseConnectionFactory : IDbConnectionFactory
|
||||
{
|
||||
private const string DiscoRegistryKey = @"SOFTWARE\Disco";
|
||||
|
||||
private IDbConnectionFactory DefaultConnectionFactory;
|
||||
private IDbConnectionFactory SqlCeConnectionFactory;
|
||||
private static string _DiscoDataContextConnectionString;
|
||||
|
||||
public static string DiscoDataContextConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DiscoDataContextConnectionString == null)
|
||||
{
|
||||
// Retrieve from Registry
|
||||
using (var key = Registry.LocalMachine.OpenSubKey(DiscoRegistryKey))
|
||||
{
|
||||
if (key != null)
|
||||
_DiscoDataContextConnectionString = (string)key.GetValue("DatabaseConnectionString", null);
|
||||
}
|
||||
}
|
||||
return _DiscoDataContextConnectionString;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetDiscoDataContextConnectionString(string ConnectionString, bool Persist)
|
||||
{
|
||||
// Set to Local Cache
|
||||
_DiscoDataContextConnectionString = ConnectionString;
|
||||
|
||||
if (Persist)
|
||||
{
|
||||
// Set to Registry
|
||||
try
|
||||
{
|
||||
using (var key = Registry.LocalMachine.CreateSubKey(DiscoRegistryKey))
|
||||
{
|
||||
key.SetValue("DatabaseConnectionString", ConnectionString, RegistryValueKind.String);
|
||||
}
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
throw new SecurityException(string.Format("Unable to write to the Registry Location: HKML\\{0}[DatabaseConnectionString]", DiscoRegistryKey), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DiscoDatabaseConnectionFactory(IDbConnectionFactory Default)
|
||||
{
|
||||
this.DefaultConnectionFactory = Default;
|
||||
this.SqlCeConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
|
||||
}
|
||||
|
||||
public System.Data.Common.DbConnection CreateConnection(string nameOrConnectionString)
|
||||
{
|
||||
if (nameOrConnectionString == "Disco.Data.Repository.DiscoDataContext")
|
||||
{
|
||||
|
||||
var connectionString = DiscoDataContextConnectionString;
|
||||
if (connectionString == null)
|
||||
{
|
||||
throw new InvalidOperationException("The Disco DataContext Connection String has not been configured");
|
||||
}
|
||||
|
||||
// Build DiscoDataContext - Use Default Connection Factory (SQLClient)
|
||||
|
||||
//return this.DefaultConnectionFactory.CreateConnection(connectionString);
|
||||
var connection = DbProviderFactories.GetFactory("System.Data.SqlClient").CreateConnection();
|
||||
connection.ConnectionString = connectionString;
|
||||
return connection;
|
||||
}
|
||||
|
||||
return SqlCeConnectionFactory.CreateConnection(nameOrConnectionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user