/// <summary> /// Sets up the static controllers in this class to all use one-another for their internal /// references to the objects. This method is used so once all the static controllers have been setup /// we can update all of their references in one hit, ensuring they all communicate with each other. /// /// This makes the default controllers coupled with one another, but not a particular reference of the /// object (useful for unit testing!). The alternative is to not have the static objects at all, but the /// code does get very messy on some of the controllers that go a few levels deep (Potato.Core.Security or ..Plugins) /// </summary> public static void Setup() { SharedReferences._masterVariables = new VariableController(); SharedReferences._masterLanguages = new LanguageController(); SharedReferences._masterSecurity = new SecurityController(); SharedReferences._masterEvents = new EventsController(); if (SharedReferences._masterVariables != null && SharedReferences._masterLanguages != null && SharedReferences._masterSecurity != null && SharedReferences._masterEvents != null) { SharedReferences._masterVariables.Shared.Variables = SharedReferences._masterLanguages.Shared.Variables = SharedReferences._masterSecurity.Shared.Variables = SharedReferences._masterEvents.Shared.Variables = SharedReferences._masterVariables; SharedReferences._masterVariables.Shared.Languages = SharedReferences._masterLanguages.Shared.Languages = SharedReferences._masterSecurity.Shared.Languages = SharedReferences._masterEvents.Shared.Languages = SharedReferences._masterLanguages; SharedReferences._masterVariables.Shared.Security = SharedReferences._masterLanguages.Shared.Security = SharedReferences._masterSecurity.Shared.Security = SharedReferences._masterEvents.Shared.Security = SharedReferences._masterSecurity; SharedReferences._masterVariables.Shared.Events = SharedReferences._masterLanguages.Shared.Events = SharedReferences._masterSecurity.Shared.Events = SharedReferences._masterEvents.Shared.Events = SharedReferences._masterEvents; _masterVariables.Execute(); _masterLanguages.Execute(); _masterSecurity.Execute(); _masterEvents.Execute(); } }