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