Class SettingContextExtensions
- Namespace
- XENBIT.ResQueServe.Core.Extensions
- Assembly
- RQS.Core.dll
Reads the SettingContextAttribute of dispatch center settings.
public static class SettingContextExtensions
- Inheritance
-
SettingContextExtensions
- Inherited Members
Methods
AppliesTo(DispatchCenterOption, DispatchCenterEnvironment)
Whether the option applies to a dispatch center of the environment (see AppliesTo(DispatchCenterOption, SettingContext)).
public static bool AppliesTo(this DispatchCenterOption option, DispatchCenterEnvironment environment)
Parameters
optionDispatchCenterOptionenvironmentDispatchCenterEnvironment
Returns
AppliesTo(DispatchCenterOption, SettingContext)
Whether the setting applies to an environment: Operational settings apply everywhere, Simulation and Real settings only to an environment of the same context. An unclassified or undefined setting applies nowhere.
public static bool AppliesTo(this DispatchCenterOption option, SettingContext environment)
Parameters
optionDispatchCenterOptionThe setting.
environmentSettingContextThe context of the environment: Simulation or Real.
Returns
AppliesToRealWorld(DispatchCenterOption)
Whether the setting applies to a real-world environment (see AppliesTo(DispatchCenterOption, SettingContext)).
public static bool AppliesToRealWorld(this DispatchCenterOption option)
Parameters
optionDispatchCenterOption
Returns
AppliesToSimulation(DispatchCenterOption)
Whether the setting applies to a simulation (see AppliesTo(DispatchCenterOption, SettingContext)).
public static bool AppliesToSimulation(this DispatchCenterOption option)
Parameters
optionDispatchCenterOption
Returns
GetOptionProblems(IEnumerable<DispatchCenterOption>?, SettingContext)
Problems of the options of a dispatch center in an environment: options that are not defined and options that do not apply to the environment (e.g. a simulation option for a real-world dispatch center). The API enforces this on every write; the frontends only hide the options.
public static IEnumerable<ProblemInformation> GetOptionProblems(this IEnumerable<DispatchCenterOption>? options, SettingContext environment)
Parameters
optionsIEnumerable<DispatchCenterOption>environmentSettingContext
Returns
GetSettingContext(Enum)
The declared context of the setting; null when the member has no SettingContextAttribute (a unit test makes sure every DispatchCenterOption member has one).
public static SettingContext? GetSettingContext(this Enum setting)
Parameters
settingEnum
Returns
GetSettingContext(DispatchCenterOption)
The declared context of the option; null for an undefined or unclassified option.
public static SettingContext? GetSettingContext(this DispatchCenterOption option)
Parameters
optionDispatchCenterOption
Returns
GetSimulationProperties<T>()
The properties of T declared as Simulation, on the type
itself or on an interface it implements (the attributes sit on e.g. IUnit, so a concrete
Unit finds them too). One property per name; the interface property reads the value of the model.
public static IReadOnlyList<PropertyInfo> GetSimulationProperties<T>()
Returns
Type Parameters
T
GetSimulationValues<T>(T)
The simulation properties of the model that are not neutral, i.e. neither the CLR default nor their DefaultValueAttribute. A real-world dispatch center may not have any.
public static IReadOnlyList<string> GetSimulationValues<T>(this T model) where T : class
Parameters
modelT
Returns
Type Parameters
T
ToSettingContext(DispatchCenterEnvironment)
The context of the settings that apply to a dispatch center of the environment.
public static SettingContext ToSettingContext(this DispatchCenterEnvironment environment)
Parameters
environmentDispatchCenterEnvironment