public ServiceProvider(bool initializeInternal = false) { Credentials = CredentialCache.DefaultCredentials; if (initializeInternal) { return; } if (ConfigurationSettings.Current == null) { Settings = new ConfigurationSettings(); return; } Settings = ConfigurationSettings.Current; NameValueCollection services = (NameValueCollection)ConfigurationManager.GetSection("Services"); if (services == null) { return; } foreach (string key in services.AllKeys) { try { Type t = Type.GetType(services[key], false); if (t == null) { continue; } IExtendedService extSvc = (IExtendedService)Activator.CreateInstance(t); _services.Add(t, extSvc); extSvc.Init(this); } catch (TypeLoadException) { throw new Exception(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Cannot load type '{0}' (key: '{1}')", services[key], key)); } } foreach (IExtendedService extSvc in _services.Values) { extSvc.InitDependencies(); } }
//private readonly IExtendedService<TimeSheetHours> timeSheetHoursService; // Inject Dependent Object // This DI Object will play roles relevant to DB connected public TimeSheetController(TimeSheetService timeSheetService) { this.timeSheetService = timeSheetService; //this.timeSheetHoursService = timeSheetHoursService; }