Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoint Routing #71

Open
dazinator opened this issue May 2, 2020 · 2 comments
Open

Endpoint Routing #71

dazinator opened this issue May 2, 2020 · 2 comments

Comments

@dazinator
Copy link
Owner

dazinator commented May 2, 2020

  • 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.
@dazinator
Copy link
Owner Author

@dazinator

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant