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

Make IUrlHelper injectable. #7900

Closed
FilipVanBouwel opened this issue Feb 24, 2019 · 2 comments
Closed

Make IUrlHelper injectable. #7900

FilipVanBouwel opened this issue Feb 24, 2019 · 2 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Comments

@FilipVanBouwel
Copy link

The IUrlHelper interface is currently not injectable through the build-in DI system. This makes it so we have to revert to solutions like this or this. It would be extremely handy to just be able to inject a IUrlHelper into your own classes that always works (like in an email sender that needs links to views/pages).

@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Feb 25, 2019
@danroth27
Copy link
Member

On .NET Core 2.2 you can use LinkGenerator. Otherwise you need to inject IUrlHelperFactory and create one.

@RehanSaeed
Copy link
Contributor

LinkGenerator has it's own problems. See #14192.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

No branches or pull requests

4 participants