Take a look at this new service and see how you’d use it once 2.2 is released. For me, the real benefit of this new service is that it can just be injected wherever you need it, not just into places where the request or response is necessary. While supplying the route values works, you can still use action names if you like. Var link = _linkGenerator.GetPathByAction( You can specify controller name if not the current controller. Gouache and watercolor on single vellum leaf (1) Graphite (2) Graphite on cream wove paper (1) Grease pencil (1) Hardware (1) Hide (2) Horn (2). LinkGenerator is different because, you can generate a link by just supplying the action and route values. UrlHelper has been used to do this before, but it required we name each action we needed to use. Public CampsController(., LinkGenerator linkGenerator)Īn obvious use-case for this is when you implement a POST in an API. Protected readonly LinkGenerator _linkGenerator To use it, you’d just inject it into your code (a controller in this case): public class CampsController : ControllerBase This is different from the UrlHelper that has been used in ASP.NET MVC for a long time in that it is just an injectable service, not depending on being called in a controller or other reference to the request.
![core generator for hider 2 core generator for hider 2](https://i.redd.it/sshl3c55vpz51.png)
LinkGenerator is a new service that handles generating links. UPDATE: 2.2 Preview 3 Changes this behavior If you haven’t seen the whole list of new ASP.NET Core 2.2 features (in Preview 3 as of the updating of this post), take a look at the announcement here:. ASP.NET Core 2.2 includes a number of new features, but this is a feature I really like.
CORE GENERATOR FOR HIDER 2 UPDATE
As ASP.NET Core 2.2 is now in preview, i’ve been looking at some of the early features for an update to one of my Pluralsight courses.