3 writes to Metadata
Microsoft.AspNetCore.Mvc.ViewFeatures (3)
ModelExplorer.cs (3)
37Metadata = metadata; 60Metadata = metadata; 82Metadata = metadata;
82 references to Metadata
Microsoft.AspNetCore.Mvc.TagHelpers (14)
InputTagHelper.cs (14)
404if (!modelExplorer.Metadata.HasNonDefaultEditFormat && 482string.IsNullOrEmpty(modelExplorer.Metadata.EditFormatString)) 489!modelExplorer.Metadata.HasNonDefaultEditFormat && 490(typeof(DateTime) == modelExplorer.Metadata.UnderlyingOrModelType || 491typeof(DateTimeOffset) == modelExplorer.Metadata.UnderlyingOrModelType || 492typeof(DateOnly) == modelExplorer.Metadata.UnderlyingOrModelType)) 511format = modelExplorer.Metadata.EditFormatString; 517format = modelExplorer.Metadata.EditFormatString; 526if (!string.IsNullOrEmpty(modelExplorer.Metadata.TemplateHint)) 528yield return modelExplorer.Metadata.TemplateHint; 531if (!string.IsNullOrEmpty(modelExplorer.Metadata.DataTypeName)) 533yield return modelExplorer.Metadata.DataTypeName; 541fieldType = modelExplorer.Metadata.UnderlyingOrModelType; 544foreach (var typeName in TemplateRenderer.GetTypeNames(modelExplorer.Metadata, fieldType))
Microsoft.AspNetCore.Mvc.ViewFeatures (42)
DefaultDisplayTemplates.cs (6)
194return new HtmlString(modelExplorer.Metadata.NullDisplayText); 200if (modelExplorer.Metadata.HtmlEncode) 212var content = new HtmlContentBuilder(modelExplorer.Metadata.Properties.Count); 215var propertyMetadata = propertyExplorer.Metadata; 261modelExplorer.Metadata.ShowForDisplay && 262!modelExplorer.Metadata.IsComplexType &&
DefaultEditorTemplates.cs (6)
238return new HtmlString(modelExplorer.Metadata.NullDisplayText); 242if (modelExplorer.Metadata.HtmlEncode) 254var content = new HtmlContentBuilder(modelExplorer.Metadata.Properties.Count); 257var propertyMetadata = propertyExplorer.Metadata; 329modelExplorer.Metadata.ShowForEdit && 330!modelExplorer.Metadata.IsComplexType &&
DefaultHtmlGenerator.cs (5)
371modelExplorer.Metadata.DisplayName ?? 372modelExplorer.Metadata.PropertyName; 956var metadata = modelExplorer.Metadata; 1313var placeholder = modelExplorer.Metadata.Placeholder; 1339foreach (var attribute in modelExplorer.Metadata.ValidatorMetadata)
DefaultValidationHtmlAttributeProvider.cs (2)
60modelExplorer.Metadata, 66modelExplorer.Metadata,
HtmlHelper.cs (3)
669modelExplorer.Metadata, 776var resolvedDisplayName = modelExplorer.Metadata.DisplayName ?? modelExplorer.Metadata.PropertyName;
ModelExplorer.cs (9)
98/// represent a type that defines the property represented by <see cref="Metadata"/>. This can 146if (Metadata.IsNullableValueType) 151return Metadata.ModelType; 157return Metadata.ModelType; 220return new ModelExplorer(_metadataProvider, Metadata, model); 224return new ModelExplorer(_metadataProvider, Container, Metadata, model); 241if (string.Equals(name, property.Metadata.PropertyName, StringComparison.Ordinal)) 401var metadata = Metadata; 402if (Metadata.ModelType != ModelType)
ModelExplorerExtensions.cs (6)
33if (modelExplorer.Metadata.SimpleDisplayProperty != null) 36modelExplorer.Metadata.SimpleDisplayProperty); 45return modelExplorer.Metadata.NullDisplayText; 48if (modelExplorer.Metadata.IsEnum && modelExplorer.Model is Enum modelEnum) 51var enumGroupedDisplayNamesAndValues = modelExplorer.Metadata.EnumGroupedDisplayNamesAndValues; 84return firstProperty.Metadata.NullDisplayText;
ModelExpression.cs (1)
39public ModelMetadata Metadata => ModelExplorer.Metadata;
TemplateBuilder.cs (1)
56_metadata = modelExplorer.Metadata;
TemplateInfo.cs (1)
117return _visitedObjects.Contains(modelExplorer.Model ?? modelExplorer.Metadata.ModelType);
ValidationHelpers.cs (1)
40return modelExplorer.Metadata.ModelBindingMessageProvider.ValueIsInvalidAccessor(attemptedValue);
ViewDataDictionary.cs (1)
289return ModelExplorer.Metadata;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (26)
ExpressionMetadataProviderTest.cs (16)
29Assert.NotNull(explorer.Metadata); 30Assert.Equal(ModelMetadataKind.Type, explorer.Metadata.MetadataKind); 47Assert.NotNull(explorer.Metadata); 48Assert.Equal(ModelMetadataKind.Property, explorer.Metadata.MetadataKind); 65Assert.NotNull(explorer.Metadata); 66Assert.Equal(ModelMetadataKind.Type, explorer.Metadata.MetadataKind); 87Assert.NotNull(explorer.Metadata); 88Assert.Equal(ModelMetadataKind.Property, explorer.Metadata.MetadataKind); 131Assert.NotNull(explorer.Metadata); 132Assert.Equal(expectedKind, explorer.Metadata.MetadataKind); 172Assert.NotNull(explorer.Metadata); 173Assert.Equal(ModelMetadataKind.Type, explorer.Metadata.MetadataKind); 194Assert.NotNull(explorer.Metadata); 195Assert.Equal(ModelMetadataKind.Type, explorer.Metadata.MetadataKind); 216Assert.NotNull(explorer.Metadata); 217Assert.Equal(ModelMetadataKind.Type, explorer.Metadata.MetadataKind);
ModelExplorerTest.cs (9)
51var baseProperty = Assert.Single(properties, p => p.Metadata.PropertyName == "Base1"); 52Assert.Equal(typeof(int), baseProperty.Metadata.ModelType); 53Assert.Equal(typeof(DerivedClass), baseProperty.Metadata.ContainerType); 56var derivedProperty = Assert.Single(properties, p => p.Metadata.PropertyName == "Derived1"); 57Assert.Equal(typeof(string), derivedProperty.Metadata.ModelType); 58Assert.Equal(typeof(DerivedClass), derivedProperty.Metadata.ContainerType); 75var baseProperty = Assert.Single(properties, p => p.Metadata.PropertyName == "Base1"); 76Assert.Equal(typeof(int), baseProperty.Metadata.ModelType); 77Assert.Equal(typeof(BaseClass), baseProperty.Metadata.ContainerType);
Rendering\DefaultTemplatesUtilities.cs (1)
336var metadata = modelExplorer.Metadata;