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

Changes to ModelMetadata provided by a ModelMetadataDetailsProvider are sometimes lost if the model property is a Nullable<T> #2539

Closed
emisaacson opened this issue May 11, 2015 · 1 comment

Comments

@emisaacson
Copy link

In one of my projects I have a registered IDisplayMetadataProvider that examines the attributes on a model's properties and sets values in ModelMetadata.AdditionalValues as necessary. I find that if:

  • the model property in question is a Nullable<T> AND
  • the default value of the property is a value other than null

then the customizations to ModelMetadata are lost by the time the view is rendered.

A minimal project to reproduce the issue is here: https://github.com/emisaacson/MetadataProviderExample

I find with this change I get the expected result (AdditionalValues is populated when rendering the view): dev...emisaacson:vd-type-checking

@danroth27 danroth27 added this to the 6.0.0-beta6 milestone May 11, 2015
@Eilon Eilon modified the milestones: 6.0.0-beta6, 6.0.0-beta7 Jul 1, 2015
@Eilon Eilon modified the milestones: 6.0.0-beta8, 6.0.0-beta7 Aug 14, 2015
dougbu added a commit that referenced this issue Aug 18, 2015
…when `Model` is non-`null`

- #2539
- reuse `ModelMetadata` and occasionally `ModelExplorer` when `ModelType` is `Nullable<T>`
dougbu added a commit that referenced this issue Aug 18, 2015
…when `Model` is non-`null`

- #2539
- reuse `ModelMetadata` and occasionally `ModelExplorer` when `ModelType` is `Nullable<T>`
@dougbu
Copy link
Member

dougbu commented Aug 18, 2015

f10a071

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

4 participants