From dab1669d779ce2390eaaedcaccdc223c6eddbeec Mon Sep 17 00:00:00 2001 From: MackHog Date: Thu, 29 Mar 2018 15:30:35 +0200 Subject: [PATCH] Update app-parts.md (#5826) --- aspnetcore/mvc/advanced/app-parts.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aspnetcore/mvc/advanced/app-parts.md b/aspnetcore/mvc/advanced/app-parts.md index c55390408f..ff3dcdccf8 100644 --- a/aspnetcore/mvc/advanced/app-parts.md +++ b/aspnetcore/mvc/advanced/app-parts.md @@ -30,7 +30,7 @@ services.AddMvc() var assembly = typeof(Startup).GetTypeInfo().Assembly; var part = new AssemblyPart(assembly); services.AddMvc() - .ConfigureApplicationPartManager(apm => p.ApplicationParts.Add(part)); + .ConfigureApplicationPartManager(apm => apm.ApplicationParts.Add(part)); ``` By default MVC will search the dependency tree and find controllers (even in other assemblies). To load an arbitrary assembly (for instance, from a plugin that isn't referenced at compile time), you can use an application part. @@ -41,9 +41,9 @@ If you have an assembly that contains controllers you don't want to be used, rem ```csharp services.AddMvc() - .ConfigureApplicationPartManager(p => + .ConfigureApplicationPartManager(apm => { - var dependentLibrary = p.ApplicationParts + var dependentLibrary = apm.ApplicationParts .FirstOrDefault(part => part.Name == "DependentLibrary"); if (dependentLibrary != null) @@ -80,8 +80,8 @@ The feature provider is added in `Startup`: ```csharp services.AddMvc() - .ConfigureApplicationPartManager(p => - p.FeatureProviders.Add(new GenericControllerFeatureProvider())); + .ConfigureApplicationPartManager(apm => + apm.FeatureProviders.Add(new GenericControllerFeatureProvider())); ``` By default, the generic controller names used for routing would be of the form *GenericController`1[Widget]* instead of *Widget*. The following attribute is used to modify the name to correspond to the generic type used by the controller: