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