Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was 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

@emisaacson

Description

@emisaacson

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions