-
Notifications
You must be signed in to change notification settings - Fork 223
Support full lambda expression parameters #53
Comments
Thanks for reporting it, we are not quite sure what is the use case for this, and would appreciate if you can provide more use cases. |
No problems.
@foreach (var item in Model.list) {
@Html.TextBoxFor(x=>x.List[i].Name)
} The problem is that you don't have an "i" reference. so then you have to put a variable outside of it and increment it at the end, which becomes very ugly. Instead this would be way better. @Model.List.Each(@=> (i) {
@Html.TextBoxFor(x=>x.List[i].Name)
})
@Html.Form<UserInputModel>(@=>(builder, i) {
@builder.Input(x=>x.List[i].Name)
} This builder can then have the conventions applied to it for its scope and all Inputs might then have a particular class or what ever the convention may be. At the moment this may have to be stored in the context.Items collection then removed when a using statement disposes or something. Its much easier to close the tag, at the end of the Form call.Hope this provides you with some more context. This style of functional programming makes it super easy to do powerful layouts in Razor. Let me know if you need and more info...or to test a spike or help out with the syntax or some dev. |
Adam - Thanks for the info. Just to let you know where we stand at the moment with Razor. We are working on another approach to improve Razor, which is where we plan to spend most of the time in the near future that will make razor more fluent by using what we call taghelpers. See #75 and similar bugs in the Razor and MVC Repos. We will eventually get back to this, though we might also add the support for Generic helpers for supporting the strongly typed ViewComponents (which is related but not exactly what you are asking for here) aspnet/Mvc#612 |
Hey guys, |
As you can tell this is in the backlog milestone. That means post RTM. |
Closing because there are no plans to implement this. |
Boo. |
It would be great if you could use lambdas in Razor, without just having the one Func<string,string> which takes one parameter item.
Here is an example syntax:
or
More info can be found here:
http://hammett.castleproject.org/index.php/2011/07/mr-3-update-castle-blade/
The text was updated successfully, but these errors were encountered: