1 override of ModelMetadata
Microsoft.AspNetCore.Mvc.Core (1)
ModelBinding\DefaultModelBindingContext.cs (1)
59public override ModelMetadata ModelMetadata
1 write to ModelMetadata
Microsoft.AspNetCore.Mvc.Core.Test (1)
Controllers\ControllerBinderDelegateProviderTest.cs (1)
244context.ModelMetadata = metadataProvider.GetMetadataForType(typeof(string));
92 references to ModelMetadata
Microsoft.AspNetCore.Mvc.Abstractions (3)
ModelBinding\ModelBindingContext.cs (3)
88/// The <see cref="ModelMetadata"/> property must be set to access this property. 90public virtual Type ModelType => ModelMetadata.ModelType; 129/// <see cref="ModelBinding.ModelMetadata"/> to assign to the <see cref="ModelMetadata"/> property.
Microsoft.AspNetCore.Mvc.Core (55)
ModelBinding\Binders\BodyModelBinder.cs (4)
112bindingContext.ModelMetadata, 148bindingContext.ModelState.AddModelError(modelBindingKey, exception, bindingContext.ModelMetadata); 177.ModelMetadata 185bindingContext.ModelState.AddModelError(modelBindingKey, exception, bindingContext.ModelMetadata);
ModelBinding\Binders\ByteArrayModelBinder.cs (1)
65bindingContext.ModelMetadata);
ModelBinding\Binders\CollectionModelBinder.cs (8)
120if (model == null && !bindingContext.ModelMetadata.HasDefaultValue) 151if (bindingContext.ModelMetadata.HasDefaultValue && (boundCollection is null || !boundCollection.Any())) 217var modelMetadata = bindingContext.ModelMetadata; 269var elementMetadata = bindingContext.ModelMetadata.ElementMetadata!; 342var elementMetadata = bindingContext.ModelMetadata.ElementMetadata!; 384bindingContext.ModelMetadata.MetadataKind != ModelMetadataKind.Type ? 385bindingContext.ModelMetadata.Name : 394bindingContext.ModelMetadata.ElementType));
ModelBinding\Binders\ComplexObjectModelBinder.cs (9)
74var modelMetadata = bindingContext.ModelMetadata; 193var metadata = bindingContext.ModelMetadata; 206bindingContext.ModelMetadata.ContainerType!.FullName)); 408var metadataProviderFilter = bindingContext.ModelMetadata.PropertyFilterProvider?.PropertyFilter; 544var modelMetadata = bindingContext.ModelMetadata; 578for (var i = 0; i < bindingContext.ModelMetadata.Properties.Count; i++) 580var propertyMetadata = bindingContext.ModelMetadata.Properties[i]; 613var parameters = bindingContext.ModelMetadata.BoundConstructor!.BoundConstructorParameters!; 730modelState.AddModelError(modelName, exception, bindingContext.ModelMetadata);
ModelBinding\Binders\ComplexTypeModelBinder.cs (9)
105var modelMetadata = bindingContext.ModelMetadata; 232var metadataProviderFilter = bindingContext.ModelMetadata.PropertyFilterProvider?.PropertyFilter; 308var binder = _propertyBinders[bindingContext.ModelMetadata]; 349if (bindingContext.ModelMetadata.Properties.Count == 0) 379for (var i = 0; i < bindingContext.ModelMetadata.Properties.Count; i++) 381var propertyMetadata = bindingContext.ModelMetadata.Properties[i]; 482var metadata = bindingContext.ModelMetadata; 495bindingContext.ModelMetadata.ContainerType.FullName)); 568modelState.AddModelError(modelName, exception, bindingContext.ModelMetadata);
ModelBinding\Binders\DateTimeModelBinder.cs (1)
53var metadata = bindingContext.ModelMetadata;
ModelBinding\Binders\DecimalModelBinder.cs (1)
55var metadata = bindingContext.ModelMetadata;
ModelBinding\Binders\DictionaryModelBinder.cs (1)
158var elementMetadata = bindingContext.ModelMetadata.ElementMetadata!;
ModelBinding\Binders\DoubleModelBinder.cs (1)
55var metadata = bindingContext.ModelMetadata;
ModelBinding\Binders\EnumTypeModelBinder.cs (3)
53bindingContext.ModelMetadata.ModelBindingMessageProvider.ValueIsInvalidAccessor( 60var modelType = bindingContext.ModelMetadata.UnderlyingOrModelType; 64if (bindingContext.ModelMetadata.IsFlagsEnum)
ModelBinding\Binders\FloatModelBinder.cs (1)
55var metadata = bindingContext.ModelMetadata;
ModelBinding\Binders\HeaderModelBinder.cs (2)
83bindingContext.ModelMetadata, 109if (bindingContext.ModelMetadata.IsEnumerableType)
ModelBinding\Binders\KeyValuePairModelBinder.cs (3)
66bindingContext.ModelMetadata.ModelBindingMessageProvider.MissingKeyOrValueAccessor()); 75bindingContext.ModelMetadata.ModelBindingMessageProvider.MissingKeyOrValueAccessor()); 96var propertyModelMetadata = bindingContext.ModelMetadata.Properties[propertyName]!;
ModelBinding\Binders\SimpleTypeModelBinder.cs (5)
55var value = bindingContext.ModelMetadata.IsFlagsEnum 63if (bindingContext.ModelMetadata.ConvertEmptyStringToNull && string.IsNullOrWhiteSpace(value)) 100bindingContext.ModelMetadata); 120if (model == null && !bindingContext.ModelMetadata.IsReferenceOrNullableType) 124bindingContext.ModelMetadata.ModelBindingMessageProvider.ValueMustNotBeNullAccessor(
ModelBinding\Binders\TryParseModelBinder.cs (3)
71if (!bindingContext.ModelMetadata.IsReferenceOrNullableType) 75bindingContext.ModelMetadata.ModelBindingMessageProvider.ValueMustNotBeNullAccessor( 104bindingContext.ModelMetadata);
MvcCoreLoggerExtensions.cs (3)
120var modelMetadata = bindingContext.ModelMetadata; 175var modelMetadata = bindingContext.ModelMetadata; 215var modelMetadata = bindingContext.ModelMetadata;
Microsoft.AspNetCore.Mvc.Core.Test (34)
ControllerBaseTest.cs (31)
2621Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property1"])); 2622Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property2"])); 2649Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property1"])); 2650Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property2"])); 2676Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property1"])); 2677Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property2"])); 2730Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Include1"])); 2731Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Include2"])); 2733Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude1"])); 2734Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude2"])); 2763Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Include1"])); 2764Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Include2"])); 2766Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude1"])); 2767Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude2"])); 2797Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property1"])); 2798Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property2"])); 2800Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude1"])); 2801Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude2"])); 2829Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property1"])); 2830Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property2"])); 2832Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude1"])); 2833Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude2"])); 2865var modelMetadata = context.ModelMetadata.Properties[propertyName]; 2913Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Include1"])); 2914Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Include2"])); 2916Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude1"])); 2917Assert.False(context.PropertyFilter(context.ModelMetadata.Properties["Exclude2"])); 2945Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property1"])); 2946Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property2"])); 2973Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property1"])); 2974Assert.True(context.PropertyFilter(context.ModelMetadata.Properties["Property2"]));
Controllers\ControllerBinderDelegateProviderTest.cs (2)
320It.Is<ModelBindingContext>(context => context.ModelMetadata == modelMetadata.Object)), 368It.Is<ModelBindingContext>(context => context.ModelMetadata == modelMetadata.Object)),
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (1)
1633if (Results.TryGetValue(bindingContext.ModelMetadata, out var result))