Replies: 1 comment
-
@gafter After realizing that someone asked to create language feature requests at chsarplang i created another ticket at #373 regarding nameof. what would you like me to do about that one? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
@taori commented on Sat Dec 26 2015
Let's say we have a method signature like this:
public IActionResult SomeMethod(int someParameter)
which is a common case in mvc.
When you're rendering action links or $.ajax calls you will have to pass route values which have to match the name of the parameter (unless something changed which i am unaware of).
Let's say i am constructing a call like this:
$.ajax("url" : "@Url.Action("SomeMethod", new {someParameter : "+someJsValue+"})");
This might potentially break on refactoring unless you do careful checking or use workarounds to render the url (which i am doing currently).
This is why i thought it would be nice if roslyn offered the option of doing it like this:
$.ajax("url" : "@Url.Action("SomeMethod", new {nameof(SomeMethod.someParameter) : "+someJsValue+"})");
Since method calls usually provide parameter names of their declaration i figured the necessary information might already exist, to provide this feature.
Would this be an option?
@alrz commented on Sat Dec 26 2015
Have you seen similar issues in MVC repo? like aspnet/Mvc/issues/2608 or aspnet/Mvc/issues/2015. I think you'd better open an issue there.
@taori commented on Sat Dec 26 2015
Not yet no. I guessed the Roslyn team knows best about this while the use case scenario just belongs to mvc
@ashmind commented on Fri Jan 01 2016
That is also useful for some DI registrations, e.g.:
@jamesbascle commented on Wed Jul 13 2016
Have talked to a number of people about this recently. Seems like a highly desired feature. Seems folks expect
to work. So throwing my hat in for support on this. I specifically would like it for registering Castle interceptors with Autofac using the .WithParameter extension method on the ContainerBuilder.
Beta Was this translation helpful? Give feedback.
All reactions