Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Bring back Controller.TryUpdateModel #415

Closed
davidfowl opened this issue May 9, 2014 · 11 comments
Closed

Bring back Controller.TryUpdateModel #415

davidfowl opened this issue May 9, 2014 · 11 comments
Assignees
Milestone

Comments

@davidfowl
Copy link
Member

No description provided.

@divega
Copy link

divega commented May 9, 2014

+1

@danroth27 danroth27 added this to the Post Alpha milestone May 13, 2014
@yishaigalatzer yishaigalatzer removed this from the Post Alpha milestone May 23, 2014
@yishaigalatzer yishaigalatzer added this to the 1.0.0-alpha2 milestone Jun 5, 2014
@pranavkm
Copy link
Contributor

A couple of questions about this:

  1. In Mvc 5, the Controller type had special knowledge about things like ValueProviders, ModelMetadataProvider etc. This is not true in Mvc 6. There doesn't seem to be specific reasons to hanging this off of the Controller in particular if we want to support POCO controllers. Is there a better location to hang this off of - for instance the https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNet.Mvc.Core/ParameterBinding/IActionBindingContextProvider.cs\ ActionBindingContext or something along those lines?
  2. There's about a dozen overloads of this method in Mvc 5 (http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.tryupdatemodel(v=vs.118).aspx). Are all the overloads necessary?

@pranavkm
Copy link
Contributor

Bump?

@pranavkm
Copy link
Contributor

  1. We need to expose on controller, but also such that it's easy enough to do in a POCO controller.

@pranavkm
Copy link
Contributor

@DamianEdwards @davidfowl do you have preferences or explicit list of which of these 10 overloads are useful?

@danroth27 danroth27 modified the milestones: 6.0.0-alpha3, 1.0.0-alpha3 Jul 7, 2014
pranavkm added a commit that referenced this issue Jul 14, 2014
This changeset reintroduces some of the overloads for
Controller.TryUpdateModel.

Fixes #415
pranavkm added a commit that referenced this issue Jul 14, 2014
This changeset reintroduces some of the overloads for
Controller.TryUpdateModel.

Fixes #415
@RoboBurned
Copy link

Microsoft.AspNetCore.All 2.1.5
The name 'TryUpdateModel' does not exist in the current context

@RoboBurned
Copy link

@pranavkm, I see async version, but there is no TryUpdateModel.
I will use this approach even if it looks more complicated.
TryUpdateModelAsync(user, ...).GetAwaiter().GetResult();

@pranavkm
Copy link
Contributor

pranavkm commented Nov 6, 2018

Use await TryUpdateModelAsync(...); in your controller action. Doing a blocking call (GetResult) may result in thread pool starvation and application deadlocks.

@RoboBurned
Copy link

@pranavkm I cannot use await because my action is not async

@davidfowl
Copy link
Member Author

@RoboBurned make the action asynchronous instead.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants