I'm using ExtCore.Mvc library and there's a problem when I have 2 controllers with the same name in 2 different extensions. Here's my code:
In ExtensionA:
public class UseEndpointsAction : IUseEndpointsAction
{
public int Priority => 1000;
public void Execute(IEndpointRouteBuilder endpointRouteBuilder, IServiceProvider serviceProvider)
{
endpointRouteBuilder.MapControllerRoute(
name: "ExtensionA",
pattern: "ExtensionA",
defaults: new { controller = "Default", action = "Index" });
}
}
In ExtensionB:
public class UseEndpointsAction : IUseEndpointsAction
{
public int Priority => 1000;
public void Execute(IEndpointRouteBuilder endpointRouteBuilder, IServiceProvider serviceProvider)
{
endpointRouteBuilder.MapControllerRoute(
name: "ExtensionB",
pattern: "ExtensionB",
defaults: new { controller = "Default", action = "Index" });
}
}
There are two controllers as "ExtensionA.Controllers.DefaultController" and "ExtensionB.Controllers.DefaultController".
When client requests this URL: "http://{domain}/ExtensionA", it gets the following error:
An unhandled exception occurred while processing the request. AmbiguousMatchException: The request matched multiple endpoints. Matches: ExtensionA.Controllers.DefaultController.Index (ExtensionA) ExtensionB.Controllers.DefaultController.Index (ExtensionB)
I want to solve it using namespace which means to resolve each route to a specific namespace. I search through the web and I read all MSDN documents yet found nothing. Any help would be appreciated.
Thanks