Skip to content

Commit 6413a96

Browse files
author
Claudia Beatriz Murialdo Garrone
committed
Merge branch 'beta' of https://github.com/genexuslabs/DotNetClasses into beta
2 parents 91f2314 + 8026b85 commit 6413a96

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

dotnet/src/dotnetcore/GxNetCoreStartup/Startup.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ public void ConfigureServices(IServiceCollection services)
175175
{
176176
OpenTelemetryService.Setup(services);
177177

178-
services.AddMvc(option => option.EnableEndpointRouting = false);
179-
180-
RegisterControllerAssemblies(services);
178+
IMvcBuilder builder = services.AddMvc(option => option.EnableEndpointRouting = false);
179+
180+
RegisterControllerAssemblies(builder);
181181

182182
services.Configure<KestrelServerOptions>(options =>
183183
{
@@ -267,16 +267,13 @@ public void ConfigureServices(IServiceCollection services)
267267
DefineCorsPolicy(services);
268268
}
269269

270-
private void RegisterControllerAssemblies(IServiceCollection services)
270+
private void RegisterControllerAssemblies(IMvcBuilder mvcBuilder)
271271
{
272-
IMvcBuilder mvcBuilder;
272+
273273
if (RestAPIHelpers.ServiceAsController() && !string.IsNullOrEmpty(VirtualPath))
274-
mvcBuilder = services.AddControllers(options =>
275-
{
276-
options.Conventions.Add(new SetRoutePrefix(new RouteAttribute(VirtualPath)));
277-
});
278-
else
279-
mvcBuilder = services.AddControllers();
274+
{
275+
mvcBuilder.AddMvcOptions(options => options.Conventions.Add(new SetRoutePrefix(new RouteAttribute(VirtualPath))));
276+
}
280277

281278
if (RestAPIHelpers.JsonSerializerCaseSensitive())
282279
{

0 commit comments

Comments
 (0)