/* * Although this is public and improper call might cause inability of a class to register it's acceptable "risk". * It's intended for static constructors invocation. */ public static void RegisterDeviceForRepair(Type deviceType, SmartPhoneServiceActivities services) { if ((!knowHow.ContainsKey(deviceType)) && (services != null)) { knowHow[deviceType] = services; } }
/* * Provide private functions for "trusted" classes */ static SmartPhone() { var services = new SmartPhoneServiceActivities(ReplaceGlass, FactoryReset); // SmartPhone<-Technician agreement regarding "private modifications" Technician.RegisterDeviceForRepair(typeof(SmartPhone), services); }