In 2 solutions I have the same controller classes spread over several Projects. In solution A the routing works as expected, in solutionB not. I have no clue why ?
[ApiController]
[Route("/api/[controller]")]
public abstract class ApiControllerBase : ControllerBase, IController
{
...
}
public class ApiCrudControllerBase<T> : ApiControllerBase where T : IModel, new()
{
...
}
[Route("/portal-api/[controller]")]
public class PortalApiCrudController<T> : ApiCrudControllerBase<T> where T : IModel, new()
{
...
}
public class RoleController : PortalApiCrudController<Role>
{
}
[HttpPost]
[Route("{roleId}/userGroup/{userGroupId}")]
public async Task<ActionResult<ApiListResponse<UserGroup>>> AddUserGroup2Role(string
roleId, string userGroupId)
{
...
}
[HttpGet]
[Route("/portal-api/roles")]
public ActionResult<ApiListResponse<Role>> Read([FromQuery] FilterSettings filterSettings)
{
...
}
}
Swagger gives the followins paths to the endpoints.
Application A:
POST /portal-api/role/{roleId}/userGroup/{userGroupId}
GET /portal-api/roles
Application B:
POST /api/role/{roleId}/userGroup/{userGroupId}
GET /portal-api/roles
It seems that in Application B the inheritance in routing is not working. I've checked nuget package versions, startup configuration, .... I can't find any difference so far.
Any suggestions ?