125 references to ModelMetadata
HtmlGenerationWebSite (3)
Components\CheckViewData - LackModel.cs (2)
14
var metadata = ViewData.
ModelMetadata
;
28
metadata = ViewData.
ModelMetadata
;
Components\CheckViewData.cs (1)
13
var metadata = ViewData.
ModelMetadata
;
Microsoft.AspNetCore.Mvc.ViewFeatures (33)
DefaultDisplayTemplates.cs (3)
26
return htmlHelper.ViewData.
ModelMetadata
.IsNullableValueType ?
88
var elementMetadata = htmlHelper.ViewData.
ModelMetadata
.ElementMetadata;
173
if (htmlHelper.ViewData.
ModelMetadata
.HideSurroundingHtml)
DefaultEditorTemplates.cs (5)
31
return htmlHelper.ViewData.
ModelMetadata
.IsNullableValueType ?
70
var elementMetadata = htmlHelper.ViewData.
ModelMetadata
.ElementMetadata;
147
if (viewData.
ModelMetadata
.HideSurroundingHtml)
158
if (viewData.
ModelMetadata
.HideSurroundingHtml)
421
var metadata = htmlHelper.ViewData.
ModelMetadata
;
ExpressionMetadataProvider.cs (1)
201
if (viewData.
ModelMetadata
.ModelType == typeof(object))
HtmlHelperOfT.cs (1)
70
var runtimeType = viewContext.ViewData.
ModelMetadata
.ModelType;
TemplateBuilder.cs (5)
81
viewData.
ModelMetadata
.DisplayFormatString :
82
viewData.
ModelMetadata
.EditFormatString;
97
string.Equals("week", viewData.
ModelMetadata
.DataTypeName, StringComparison.OrdinalIgnoreCase)))
102
else if (viewData.
ModelMetadata
.IsEnum && _model is Enum modelEnum)
106
var enumGrouped = viewData.
ModelMetadata
.EnumGroupedDisplayNamesAndValues;
TemplateRenderer.cs (1)
147
var metadata = _viewData.
ModelMetadata
;
ValidationHelpers.cs (1)
59
var metadata = viewData.
ModelMetadata
;
ViewDataDictionary.cs (16)
85
/// <see cref="Type"/> of <see cref="Model"/> values expected. Used to set <see cref="
ModelMetadata
"/>.
106
/// <see cref="Type"/> of <see cref="Model"/> values expected. Used to set <see cref="
ModelMetadata
"/>.
136
/// <see cref="Type"/> of <see cref="Model"/> values expected. Used to set <see cref="
ModelMetadata
"/>.
164
/// <see cref="Type"/> of <see cref="Model"/> values expected. Used to set <see cref="
ModelMetadata
"/>.
197
if (source.
ModelMetadata
.MetadataKind == ModelMetadataKind.Type &&
198
source.
ModelMetadata
.ModelType == typeof(object) &&
205
else if (!declaredModelType.IsAssignableFrom(source.
ModelMetadata
.ModelType))
210
else if (modelType != null && !source.
ModelMetadata
.ModelType.IsAssignableFrom(modelType))
226
source.
ModelMetadata
,
443
if (
ModelMetadata
.MetadataKind == ModelMetadataKind.Type &&
444
ModelMetadata
.ModelType == typeof(object) &&
452
else if (modelType != null && !
ModelMetadata
.ModelType.IsAssignableFrom(modelType))
464
!
ModelMetadata
.IsReferenceOrNullableType &&
465
_declaredModelType !=
ModelMetadata
.ModelType)
477
ModelExplorer = new ModelExplorer(_metadataProvider, ModelExplorer.Container,
ModelMetadata
, value);
512
return
ModelMetadata
.IsReferenceOrNullableType;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (88)
ControllerTest.cs (2)
424
Assert.NotNull(controller.ViewData.
ModelMetadata
);
425
Assert.Equal(expectedType, controller.ViewData.
ModelMetadata
.ModelType);
DefaultEditorTemplatesTest.cs (1)
301
Assert.Equal(html.ViewData.
ModelMetadata
.NullDisplayText, HtmlContentUtilities.HtmlContentToString(result));
ViewComponents\ViewComponentContextTest.cs (3)
57
Assert.Same(viewData.
ModelMetadata
, viewComponentContext.ViewData.
ModelMetadata
);
108
Assert.Equal(expectedType, viewComponentContext.ViewData.
ModelMetadata
.ModelType);
ViewDataDictionaryOfTModelTest.cs (48)
25
Assert.NotNull(viewData.
ModelMetadata
);
52
Assert.NotNull(viewData1.
ModelMetadata
);
53
Assert.Equal(typeof(TestModel), viewData1.
ModelMetadata
.ModelType);
54
Assert.Same(source.
ModelMetadata
, viewData1.
ModelMetadata
);
64
Assert.NotNull(viewData2.
ModelMetadata
);
65
Assert.Equal(typeof(TestModel), viewData2.
ModelMetadata
.ModelType);
66
Assert.Same(source.
ModelMetadata
, viewData2.
ModelMetadata
);
91
Assert.NotNull(viewData1.
ModelMetadata
);
92
Assert.Equal(typeof(TestModel), viewData1.
ModelMetadata
.ModelType);
93
Assert.Same(source.
ModelMetadata
, viewData1.
ModelMetadata
);
103
Assert.NotNull(viewData2.
ModelMetadata
);
104
Assert.Equal(typeof(TestModel), viewData2.
ModelMetadata
.ModelType);
105
Assert.Same(source.
ModelMetadata
, viewData2.
ModelMetadata
);
127
Assert.NotNull(viewData.
ModelMetadata
);
128
Assert.Equal(typeof(SupremeTestModel), viewData.
ModelMetadata
.ModelType);
129
Assert.Same(source.
ModelMetadata
, viewData.
ModelMetadata
);
148
Assert.NotNull(viewData.
ModelMetadata
);
149
Assert.Equal(typeof(SupremeTestModel), viewData.
ModelMetadata
.ModelType);
150
Assert.Same(source.
ModelMetadata
, viewData.
ModelMetadata
);
171
Assert.NotNull(viewData.
ModelMetadata
);
172
Assert.Equal(typeof(int), viewData.
ModelMetadata
.ModelType);
173
Assert.NotSame(source.
ModelMetadata
, viewData.
ModelMetadata
);
192
Assert.NotNull(viewData1.
ModelMetadata
);
194
Assert.Equal(expectedType, viewData1.
ModelMetadata
.ModelType);
197
Assert.NotNull(viewData2.
ModelMetadata
);
199
Assert.Equal(expectedType, viewData2.
ModelMetadata
.ModelType);
256
Assert.NotNull(viewData.
ModelMetadata
);
257
Assert.NotSame(source.
ModelMetadata
, viewData.
ModelMetadata
);
258
Assert.Equal(expectedType, viewData.
ModelMetadata
.ModelType);
279
Assert.Same(source.
ModelMetadata
, viewData.
ModelMetadata
);
280
Assert.Equal(typeof(int?), viewData.
ModelMetadata
.ModelType);
298
Assert.NotSame(source.
ModelMetadata
, viewData.
ModelMetadata
);
299
Assert.NotEqual(source.
ModelMetadata
.ModelType, viewData.
ModelMetadata
.ModelType);
300
Assert.Equal(typeof(int?), viewData.
ModelMetadata
.ModelType);
320
Assert.Same(source.
ModelMetadata
, viewData.
ModelMetadata
);
321
Assert.Equal(typeof(TestModel), viewData.
ModelMetadata
.ModelType);
ViewDataDictionaryTest.cs (33)
25
Assert.NotNull(viewData.
ModelMetadata
);
43
Assert.NotNull(viewData.
ModelMetadata
);
62
Assert.NotNull(viewData.
ModelMetadata
);
82
Assert.NotNull(viewData.
ModelMetadata
);
106
Assert.NotNull(viewData.
ModelMetadata
);
206
Assert.NotNull(viewData.
ModelMetadata
);
207
Assert.Equal(typeof(TestModel), viewData.
ModelMetadata
.ModelType);
208
Assert.Same(source.
ModelMetadata
, viewData.
ModelMetadata
);
249
Assert.Same(source.
ModelMetadata
, viewData.
ModelMetadata
);
263
Assert.Same(source.
ModelMetadata
, viewData.
ModelMetadata
);
264
Assert.Equal(typeof(object), viewData.
ModelMetadata
.ModelType);
283
var sourceMetadata = source.
ModelMetadata
;
291
Assert.NotSame(source.
ModelMetadata
, viewData.
ModelMetadata
);
292
Assert.Equal(expectedType, viewData.
ModelMetadata
.ModelType);
314
Assert.Same(source.
ModelMetadata
, viewData.
ModelMetadata
);
327
var originalMetadata = viewData.
ModelMetadata
;
334
Assert.NotNull(viewData.
ModelMetadata
);
338
Assert.Same(originalMetadata, viewData.
ModelMetadata
);
361
Assert.NotNull(viewData.
ModelMetadata
);
363
Assert.Equal(typeof(bool), viewData.
ModelMetadata
.ModelType);
385
Assert.NotNull(viewData.
ModelMetadata
);
387
Assert.Same(metadata, viewData.
ModelMetadata
);
419
var originalMetadata = viewData.
ModelMetadata
;
426
Assert.NotNull(viewData.
ModelMetadata
);
430
Assert.Same(originalMetadata, viewData.
ModelMetadata
);
446
var originalMetadata = viewData.
ModelMetadata
;
453
Assert.NotNull(viewData.
ModelMetadata
);
455
Assert.Same(originalMetadata, viewData.
ModelMetadata
);
ViewDataOfTTest.cs (1)
64
Assert.NotNull(viewData.
ModelMetadata
);
XmlFormattersWebSite (1)
Controllers\SerializableErrorController.cs (1)
26
ModelState.AddModelError("key2", exception, ViewData.
ModelMetadata
);