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

Add ModelBindingResult.IsFatalError and make body binding more consistent #2695

Closed
wants to merge 1 commit into from

Conversation

dougbu
Copy link
Member

@dougbu dougbu commented Jun 14, 2015

nits:

  • address minor inconsistencies in ModelBindingContext
  • use System.Reflection.Extensions package a bit more, where it's already referenced
  • remove some unused resources

…istent

- part I of II for #2445 (with a duplicate code PR to follow)
- needed for #2445 because new `ModelState` entries for values will make inconsisteny worse
- change `BodyModelBinder` to use same keys for all `ModelBindingResult`s and `ModelState` entries
 - return fatal error result if formatter adds an error to `ModelState`
 - update potential callers to avoid avoid ignoring `IsFatalError`
- fix test attempting to serialize all of `ModelState`
 - will be borked with additional `RawValue`s in state
- fix two other tests that serialized `ModelState` but checked only `IsValid`

nits:
- address minor inconsistencies in `ModelBindingContext`
- use `System.Reflection.Extensions` package a bit more, where it's already referenced
- remove some unused resources
@dougbu
Copy link
Member Author

dougbu commented Jun 14, 2015

/cc @harshgMSFT @rynowak

/// Creates a new <see cref="ModelBindingResult"/> indicating a fatal error.
/// </summary>
/// <param name="key">The key using which was used to attempt binding the model.</param>
public ModelBindingResult(string key)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In future PRs remove all public constructors and use explicit static factory methods instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rynowak if you feel strongly about the factory method approach, please file a bug. I hesitate because this would affect all IModelBinder implementations.

@dougbu
Copy link
Member Author

dougbu commented Jun 17, 2015

:shipit: from @rynowak

@dougbu
Copy link
Member Author

dougbu commented Jun 21, 2015

c4fa402

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

Successfully merging this pull request may close these issues.

2 participants