Skip to content

Commit

Permalink
Merge pull request #1626 from riganti/feature/autoui-configuration
Browse files Browse the repository at this point in the history
Added an option to configure AutoUIConfiguration
  • Loading branch information
acizmarik committed Apr 5, 2023
2 parents ae652a8 + 4f4c79a commit 10ca9fa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/AutoUI/Core/AutoUIExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using DotVVM.Framework.Controls;
using DotVVM.Framework.ViewModel.Validation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

namespace DotVVM.AutoUI
{
Expand All @@ -21,8 +22,15 @@ public static IDotvvmServiceCollection AddAutoUI(this IDotvvmServiceCollection s
configure?.Invoke(autoUiConfiguration);

// add the configuration of AutoUI to the service collection
services.Services.AddSingleton(serviceProvider => autoUiConfiguration);

services.Services.AddSingleton(serviceProvider =>
{
foreach (var conf in serviceProvider.GetServices<IConfigureOptions<AutoUIConfiguration>>())
{
conf.Configure(autoUiConfiguration);
}
return autoUiConfiguration;
});

RegisterDefaultProviders(services.Services, autoUiConfiguration);
RegisterResourceFileProviders(services.Services, autoUiConfiguration);

Expand Down

0 comments on commit 10ca9fa

Please sign in to comment.