Skip to content

Endpoint Routing #71

Description

@dazinator
  • Use EndpointDataSource to expose list of custom Endpoints, each one representing a Tenant in my system, more specifically that tenants RequestDelegate / middleware pipeline (lazily constructed, asynchronously, upon first execution of the endpoint)
  • Associate each endpoint with its own RouteTemplate that uses a custom constraint that will only succeed if the current Tenant ID (from HttpContext.Items) matches that endpoints Tenant ID. e.g: '{**path:tenant(1)}' for the endpoint for Tenant 1, '{**path:tenant(1)}' for the endpoint for Tenant 2 etc.
  • Keep the logic that runs on every request and works out what the TenantID is, in a middleware component, added at the start of the pipeline. It puts the value in HttpContext.Items. This then means the the Endpoints stuff - which is dependenct on that value should work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions