Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Use DI Container to initialize Option classes #110

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public MicrosoftGraphExtensionConfigProvider(IOptions<GraphOptions> options,
IGraphSubscriptionStore subscriptionStore)
{
_options = options.Value;
_options.SetAppSettings(appSettings);
_graphServiceClientManager = new GraphServiceClientManager(_options, tokenConverter, graphClientProvider);
_subscriptionStore = subscriptionStore;
_loggerFactory = loggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ public static IWebJobsBuilder AddMicrosoftGraph(this IWebJobsBuilder builder)
}

builder.AddExtension<MicrosoftGraphExtensionConfigProvider>()
.BindOptions<GraphOptions>()
.BindOptions<TokenOptions>()
.Services
.AddAuthTokenServices()
.AddSingleton<IAsyncConverter<TokenBaseAttribute, string>, TokenConverter>()
.AddSingleton<IGraphServiceClientProvider, GraphServiceClientProvider>()
.AddSingleton<IGraphSubscriptionStore, WebhookSubscriptionStore>();
.AddSingleton<IGraphSubscriptionStore, WebhookSubscriptionStore>()
.AddOptions<GraphOptions>().Configure<INameResolver>((option, appSettings) =>
{
option.SetAppSettings(appSettings);
})
.Services
.AddOptions<TokenOptions>().Configure<INameResolver>((option, appSettings) =>
{
option.SetAppSettings(appSettings);
});

return builder;
}

Expand Down