//------------------------------------------------------ //--Plugin Execution //------------------------------------------------------ public override void Log(IDictionary <string, object> moduleLog) { moduleLog["Application:Settings"] = Context.AllPluginTypes .Where(t => t.IsConcreteTypeDerivedFrom <IAppSettings>()) .Select(t => new { SettingsClass = t.AssemblyQualifiedName, SectionPath = SettingsExtensions.GetSectionPath(t) }); }
//------------------------------------------------------ //--Plugin Initialization //------------------------------------------------------ public override void RegisterServices(IServiceCollection services) { IEnumerable <Type> appSettingTypes = Context.AllPluginTypes .Where(t => t.IsConcreteTypeDerivedFrom <IAppSettings>()); foreach (Type appSettingType in appSettingTypes) { string sectionPath = SettingsExtensions.GetSectionPath(appSettingType); if (string.IsNullOrWhiteSpace(sectionPath)) { Context.BootstrapLogger.Add(LogLevel.Warning, $"The section path for setting type: {appSettingType.AssemblyQualifiedName} could " + $"not be determined. Make sure the attribute: {typeof(ConfigurationSectionAttribute)} is specified."); continue; } // This is a non-generic version that is automatically called and adds the // configuration-setting to the container. Eliminates having to manually make // call for each setting. services.Configure(appSettingType, Context.Configuration.GetSection(sectionPath)); } }