Hello:
Please see my sample code below. I'm trying to get the "TenantName" Route attribute defined at the Controller level.
In the controller constructor, I need to get the "TenantName" value.. How would I do that?
[Route("{TenantName}/api")] public class SomeController : Controller { private readonly IConfiguration configuration; private IHostingEnvironment env; public SomeController(IConfiguration configuration, IHostingEnvironment environment) { this.configuration = configuration; this.env = environment; //HOW TO GET THE TENANT NAME {TenantName} HERE? //RouteData.Values["TenantName"]; DOESN'T WORK HERE BECAUSE ROUTEDATA IS NULL! //WHAT KIND OF DI SHOULD I DO? } }