You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If this is not easy for some reason, we can mark the action method with [Tupled] attribute to direct the view to inspect the view for the record properties.
this can be called tupled model or anonymous model, and Razor should generate it as a full class:
But we need tag helpers to apply the effect of the [Required] and [UIHint("email")] directly on the html input elements used for email and password, which can be easier with some tag helpers, say asp-required and asp-hint.
In this case, we just define the same tuple as a parameter for the action method:
@VBAndCs Razor & MVC is based on C#. We don't independently design language extensions to C# that are specific to Razor. The right place to discuss this is with the C# folks.
We add many trivial classes corresponding to each view, like this one needed for login view:
It will be better if we can express it as a record like this:
But this needs to allow mutable records, which I wish to reconsider!
This can be more better, if it can be expressed inline as a tuple-like record, to be used directly in the view:
And in the post method, dependency injection can resolve the arguments from the tupled model object:
If this is not easy for some reason, we can mark the action method with
[Tupled]
attribute to direct the view to inspect the view for the record properties.this can be called tupled model or anonymous model, and Razor should generate it as a full class:
and the view will be compiled to:
Another approach is just to use tuples:
But we need tag helpers to apply the effect of the [Required] and [UIHint("email")] directly on the html input elements used for email and password, which can be easier with some tag helpers, say asp-required and asp-hint.
In this case, we just define the same tuple as a parameter for the action method:
The text was updated successfully, but these errors were encountered: