Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void AddThemes(this IServiceCollection services, Action<ThemesOptions> setup) {
- services.Configure(setup);
- }
- public class ThemesOptions {
- public IEnumerable<string> Themes { get; set; }
- }
- services.AddThemes(options => {
- options.Themes = Configuration.GetSection("Themes").Get<ThemesOptions>().Themes;
- });
- services.AddThemes(options => {
- options = Configuration.GetSection("Themes").Get<ThemesOptions>();
- });
- services.AddThemes(options => Configuration.GetSection("Themes"));
- public static void AddThemes(this IServiceCollection services, IConfiguration configuration) {
- services.Configure<ThemesOptions>(configuration.GetSection("Themes"));
- }
- services.AddThemes(Configuration);
Add Comment
Please, Sign In to add comment