Update: Configuration Optimisation and Caching

Loads entire configuration at start-up (rather than scope-based
loading). Deserialization occurs once, with the resulting value cached
and replayed if the requested type matches.
This commit is contained in:
Gary Sharp
2014-05-07 22:45:59 +10:00
parent 6b2cd47610
commit fb6067afc3
19 changed files with 455 additions and 282 deletions
@@ -31,7 +31,7 @@ namespace Disco.Web.Areas.Config.Controllers
if (m == null || m.DeviceProfile == null)
throw new ArgumentException("Invalid Device Profile Id", "id");
m.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses;
m.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
if (m.DeviceProfile.DefaultOrganisationAddress.HasValue)
m.DefaultOrganisationAddress = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(m.DeviceProfile.DefaultOrganisationAddress.Value);
@@ -2,6 +2,7 @@
using Disco.Services.Authorization;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Web;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
@@ -18,7 +19,7 @@ namespace Disco.Web.Areas.Config.Controllers
viewModel.OrganisationName = Database.DiscoConfiguration.OrganisationName;
viewModel.MultiSiteMode = Database.DiscoConfiguration.MultiSiteMode;
viewModel.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses;
viewModel.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigOrganisationIndexModel>(this.ControllerContext, viewModel);
+1 -1
View File
@@ -2053,7 +2053,7 @@
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" />
<UserProperties BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+1 -1
View File
@@ -96,7 +96,7 @@ namespace Disco.Web.Models.Job
if (!string.IsNullOrEmpty(WarrantyProviderId))
WarrantyProvider = Plugins.GetPluginFeature(WarrantyProviderId, typeof(WarrantyProviderFeature));
this.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses;
this.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
if (!IsPostBack && !this.OrganisationAddressId.HasValue)
{