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