public static IMvcBuilder AddFluentActions(this IMvcBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            // Stop if our feature provider has already been added (AddFluentActions has already been called)
            if (builder.Services.Any(s => s.ServiceType == typeof(FluentActionControllerFeatureProviderContext)))
            {
                return(builder);
            }

            var context = new FluentActionControllerFeatureProviderContext();

            builder.Services.TryAddSingleton(context);

            var fluentActionControllerFeatureProvider = new FluentActionControllerFeatureProvider(context);

            return(builder.ConfigureApplicationPartManager(manager =>
            {
                manager.FeatureProviders.Add(fluentActionControllerFeatureProvider);
            }));
        }
Exemple #2
0
 public FluentActionControllerFeatureProvider(FluentActionControllerFeatureProviderContext context)
 {
     Context = context;
 }