6 types derived from ModelMetadata
Microsoft.AspNetCore.Grpc.Swagger (1)
Internal\GrpcModelMetadata.cs (1)
11
internal sealed class GrpcModelMetadata :
ModelMetadata
Microsoft.AspNetCore.Mvc.Abstractions.Test (1)
ModelBinding\ModelMetadataTest.cs (1)
444
private class TestModelMetadata :
ModelMetadata
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
EndpointModelMetadata.cs (1)
11
internal sealed class EndpointModelMetadata :
ModelMetadata
Microsoft.AspNetCore.Mvc.Core (1)
ModelBinding\Metadata\DefaultModelMetadata.cs (1)
16
public class DefaultModelMetadata :
ModelMetadata
Microsoft.AspNetCore.Mvc.Core.Test (2)
Controllers\ControllerBinderDelegateProviderTest.cs (1)
1453
public abstract class FakeModelMetadata :
ModelMetadata
ModelBinding\ParameterBinderTest.cs (1)
842
public abstract class FakeModelMetadata :
ModelMetadata
1228 references to ModelMetadata
HtmlGenerationWebSite (2)
Components\CheckViewData - LackModel.cs (1)
14
var
metadata = ViewData.ModelMetadata;
Components\CheckViewData.cs (1)
13
var
metadata = ViewData.ModelMetadata;
Microsoft.AspNetCore.Grpc.Swagger (1)
Internal\GrpcModelMetadata.cs (1)
28
public override
ModelMetadata
ElementMetadata { get; }
Microsoft.AspNetCore.Mvc.Abstractions (134)
ApiExplorer\ApiParameterDescription.cs (1)
17
public
ModelMetadata
ModelMetadata { get; set; } = default!;
ApiExplorer\ApiResponseType.cs (2)
19
/// Gets or sets <see cref="ModelBinding.
ModelMetadata
"/> for the <see cref="Type"/> or null.
24
public
ModelMetadata
? ModelMetadata { get; set; }
Formatters\InputFormatterContext.cs (6)
26
/// The <see cref="
ModelMetadata
"/> of the model to deserialize.
35
ModelMetadata
metadata,
52
/// The <see cref="
ModelMetadata
"/> of the model to deserialize.
64
ModelMetadata
metadata,
108
/// Gets the requested <see cref="
ModelMetadata
"/> of the request body deserialization.
110
public
ModelMetadata
Metadata { get; }
ModelBinding\BindingInfo.cs (9)
102
/// This overload does not account for <see cref="BindingInfo"/> specified via <see cref="
ModelMetadata
"/>. Consider using
103
/// <see cref="GetBindingInfo(IEnumerable{object},
ModelMetadata
)"/> overload, or <see cref="TryApplyBindingInfo(
ModelMetadata
)"/>
199
/// <param name="modelMetadata">The <see cref="
ModelMetadata
"/>.</param>
201
public static BindingInfo? GetBindingInfo(IEnumerable<object> attributes,
ModelMetadata
modelMetadata)
225
/// <param name="modelMetadata">The <see cref="
ModelMetadata
"/>.</param>
228
public bool TryApplyBindingInfo(
ModelMetadata
modelMetadata)
280
public Func<
ModelMetadata
, bool> PropertyFilter => CreatePropertyFilter();
282
private Func<
ModelMetadata
, bool> CreatePropertyFilter()
ModelBinding\EnumGroupAndName.cs (1)
7
/// An abstraction used when grouping enum values for <see cref="
ModelMetadata
.EnumGroupedDisplayNamesAndValues"/>.
ModelBinding\IModelMetadataProvider.cs (5)
7
/// A provider that can supply instances of <see cref="
ModelMetadata
"/>.
18
/// <returns>A <see cref="
ModelMetadata
"/> instance describing the <see cref="Type"/>.</returns>
19
ModelMetadata
GetMetadataForType(Type modelType);
25
/// <returns>A set of <see cref="
ModelMetadata
"/> instances describing properties of the <see cref="Type"/>.</returns>
26
IEnumerable<
ModelMetadata
> GetMetadataForProperties(Type modelType);
ModelBinding\IPropertyFilterProvider.cs (1)
19
Func<
ModelMetadata
, bool> PropertyFilter { get; }
ModelBinding\Metadata\ModelMetadataIdentity.cs (1)
9
/// A key type which identifies a <see cref="
ModelMetadata
"/>.
ModelBinding\Metadata\ModelMetadataKind.cs (5)
7
/// Enumeration for the kinds of <see cref="
ModelMetadata
"/>
12
/// Used for <see cref="
ModelMetadata
"/> for a <see cref="System.Type"/>.
17
/// Used for <see cref="
ModelMetadata
"/> for a property.
22
/// Used for <see cref="
ModelMetadata
"/> for a parameter.
27
/// <see cref="
ModelMetadata
"/> for a constructor.
ModelBinding\ModelBinderProviderContext.cs (6)
14
/// <param name="metadata">The <see cref="
ModelMetadata
"/> for the model.</param>
16
public abstract IModelBinder CreateBinder(
ModelMetadata
metadata);
22
/// <param name="metadata">The <see cref="
ModelMetadata
"/> for the model.</param>
26
public virtual IModelBinder CreateBinder(
ModelMetadata
metadata, BindingInfo bindingInfo)
37
/// Gets the <see cref="
ModelMetadata
"/>.
39
public abstract
ModelMetadata
Metadata { get; }
ModelBinding\ModelBindingContext.cs (5)
61
public abstract
ModelMetadata
ModelMetadata { get; set; }
96
public abstract Func<
ModelMetadata
, bool>? PropertyFilter { get; set; }
129
/// <see cref="ModelBinding.
ModelMetadata
"/> to assign to the <see cref="ModelMetadata"/> property.
136
/// <see cref="EnterNestedScope(
ModelMetadata
, string, string, object)"/> is called.
139
ModelMetadata
modelMetadata,
ModelBinding\ModelMetadata.cs (36)
23
public abstract class ModelMetadata : IEquatable<
ModelMetadata
?>, IModelMetadataProvider
26
/// The default value of <see cref="
ModelMetadata
.Order"/>.
45
private IReadOnlyList<
ModelMetadata
>? _boundProperties;
46
private IReadOnlyDictionary<
ModelMetadata
,
ModelMetadata
>? _parameterMapping;
47
private IReadOnlyDictionary<
ModelMetadata
,
ModelMetadata
>? _boundConstructorPropertyMapping;
52
/// Creates a new <see cref="
ModelMetadata
"/>.
75
public virtual
ModelMetadata
? ContainerMetadata
120
/// Gets the collection of <see cref="
ModelMetadata
"/> instances for the model's properties.
124
internal IReadOnlyList<
ModelMetadata
> BoundProperties
141
var boundProperties = new List<
ModelMetadata
>();
143
foreach (
var
metadata in Properties)
163
internal IReadOnlyDictionary<
ModelMetadata
,
ModelMetadata
> BoundConstructorParameterMapping
178
internal IReadOnlyDictionary<
ModelMetadata
,
ModelMetadata
> BoundConstructorPropertyMapping
190
/// Gets <see cref="
ModelMetadata
"/> instance for a constructor of a record type that is used during binding and validation.
192
public virtual
ModelMetadata
? BoundConstructor { get; }
195
/// Gets the collection of <see cref="
ModelMetadata
"/> instances for parameters on a <see cref="BoundConstructor"/>.
198
public virtual IReadOnlyList<
ModelMetadata
>? BoundConstructorParameters { get; }
251
/// Gets the <see cref="
ModelMetadata
"/> for elements of <see cref="ModelType"/> if that <see cref="Type"/>
255
/// <see cref="
ModelMetadata
"/> for <c>T</c> if <see cref="ModelType"/> implements
256
/// <see cref="IEnumerable{T}"/>. <see cref="
ModelMetadata
"/> for <c>object</c> if <see cref="ModelType"/>
260
public abstract
ModelMetadata
? ElementMetadata { get; }
422
/// validated. If <c>null</c>, properties with this <see cref="
ModelMetadata
"/> are validated.
667
var parameterMapping = new Dictionary<
ModelMetadata
,
ModelMetadata
>();
668
var propertyMapping = new Dictionary<
ModelMetadata
,
ModelMetadata
>();
670
foreach (
var
parameter in boundParameters)
672
var
property = Properties.FirstOrDefault(p =>
712
public bool Equals(
ModelMetadata
? other)
732
return Equals(obj as
ModelMetadata
);
814
public virtual
ModelMetadata
GetMetadataForType(Type modelType)
820
public virtual IEnumerable<
ModelMetadata
> GetMetadataForProperties(Type modelType)
ModelBinding\ModelMetadataProvider.cs (13)
9
/// A provider that can supply instances of <see cref="
ModelMetadata
"/>.
17
/// <returns>A set of <see cref="
ModelMetadata
"/> instances describing properties of the <see cref="Type"/>.</returns>
18
public abstract IEnumerable<
ModelMetadata
> GetMetadataForProperties(Type modelType);
24
/// <returns>A <see cref="
ModelMetadata
"/> instance describing the <see cref="Type"/>.</returns>
25
public abstract
ModelMetadata
GetMetadataForType(Type modelType);
31
/// <returns>A <see cref="
ModelMetadata
"/> instance describing the <paramref name="parameter"/>.</returns>
32
public abstract
ModelMetadata
GetMetadataForParameter(ParameterInfo parameter);
39
/// <returns>A <see cref="
ModelMetadata
"/> instance describing the <paramref name="parameter"/>.</returns>
40
public virtual
ModelMetadata
GetMetadataForParameter(ParameterInfo parameter, Type modelType)
50
/// <returns>A <see cref="
ModelMetadata
"/> instance describing the <paramref name="propertyInfo"/>.</returns>
51
public virtual
ModelMetadata
GetMetadataForProperty(PropertyInfo propertyInfo, Type modelType)
61
/// <returns>A <see cref="
ModelMetadata
"/> instance describing the <paramref name="constructor"/>.</returns>
62
public virtual
ModelMetadata
GetMetadataForConstructor(ConstructorInfo constructor, Type modelType)
ModelBinding\ModelPropertyCollection.cs (7)
10
/// A read-only collection of <see cref="
ModelMetadata
"/> objects which represent model properties.
12
public class ModelPropertyCollection : ReadOnlyCollection<
ModelMetadata
>
18
public ModelPropertyCollection(IEnumerable<
ModelMetadata
> properties)
24
/// Gets a <see cref="
ModelMetadata
"/> instance for the property corresponding to <paramref name="propertyName"/>.
30
/// The <see cref="
ModelMetadata
"/> instance for the property specified by <paramref name="propertyName"/>, or
33
public
ModelMetadata
? this[string propertyName]
41
var
property = Items[i];
ModelBinding\ModelStateDictionary.cs (9)
97
/// <see cref="AddModelError(string, Exception,
ModelMetadata
)"/> or
98
/// <see cref="TryAddModelError(string, Exception,
ModelMetadata
)"/>.
197
/// when <see cref="
ModelMetadata
"/> is not available or the exact <paramref name="exception"/>
199
/// Where <see cref="
ModelMetadata
"/> is available, use <see cref="AddModelError(string, Exception,
ModelMetadata
)"/> instead.
238
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with the model.</param>
239
public void AddModelError(string key, Exception exception,
ModelMetadata
metadata)
257
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with the model.</param>
262
public bool TryAddModelError(string key, Exception exception,
ModelMetadata
metadata)
ModelBinding\Validation\ClientModelValidationContext.cs (2)
15
/// <param name="metadata">The <see cref="
ModelMetadata
"/> for validation.</param>
20
ModelMetadata
metadata,
ModelBinding\Validation\ClientValidatorProviderContext.cs (5)
14
/// <param name="modelMetadata">The <see cref="ModelBinding.
ModelMetadata
"/> for the model being validated.
17
public ClientValidatorProviderContext(
ModelMetadata
modelMetadata, IList<ClientValidatorItem> items)
24
/// Gets the <see cref="ModelBinding.
ModelMetadata
"/>.
26
public
ModelMetadata
ModelMetadata { get; }
32
/// This property provides convenience access to <see cref="
ModelMetadata
.ValidatorMetadata"/>.
ModelBinding\Validation\IValidationStrategy.cs (2)
15
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with <paramref name="model"/>.</param>
19
IEnumerator<ValidationEntry> GetChildren(
ModelMetadata
metadata, string key, object model);
ModelBinding\Validation\ModelValidationContext.cs (2)
15
/// <param name="modelMetadata">The <see cref="
ModelMetadata
"/> for validation.</param>
21
ModelMetadata
modelMetadata,
ModelBinding\Validation\ModelValidationContextBase.cs (3)
19
ModelMetadata
modelMetadata,
37
/// Gets the <see cref="ModelBinding.
ModelMetadata
"/>.
39
public
ModelMetadata
ModelMetadata { get; }
ModelBinding\Validation\ModelValidatorProviderContext.cs (5)
14
/// <param name="modelMetadata">The <see cref="ModelBinding.
ModelMetadata
"/>.</param>
16
public ModelValidatorProviderContext(
ModelMetadata
modelMetadata, IList<ValidatorItem> items)
23
/// Gets the <see cref="ModelBinding.
ModelMetadata
"/>.
25
public
ModelMetadata
ModelMetadata { get; set; }
31
/// This property provides convenience access to <see cref="
ModelMetadata
.ValidatorMetadata"/>.
ModelBinding\Validation\ValidationEntry.cs (6)
17
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with <paramref name="model"/>.</param>
20
public ValidationEntry(
ModelMetadata
metadata, string key, object? model)
34
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with the <see cref="Model"/>.</param>
37
public ValidationEntry(
ModelMetadata
metadata, string key, Func<object?> modelAccessor)
55
/// The <see cref="
ModelMetadata
"/> associated with <see cref="Model"/>.
57
public
ModelMetadata
Metadata { get; }
ModelBinding\Validation\ValidationStateEntry.cs (2)
18
/// Gets or sets the <see cref="
ModelMetadata
"/> associated with the entry.
20
public
ModelMetadata
Metadata { get; set; } = default!;
Microsoft.AspNetCore.Mvc.Abstractions.Test (30)
ModelBinding\BindingInfoTest.cs (10)
112
var
modelMetadata = provider.GetMetadataForType(modelType);
133
var
modelMetadata = provider.GetMetadataForType(modelType);
161
var
modelMetadata = provider.GetMetadataForType(modelType);
184
var
modelMetadata = provider.GetMetadataForType(modelType);
210
var
modelMetadata = provider.GetMetadataForType(modelType);
237
var
modelMetadata = provider.GetMetadataForType(modelType);
259
var
modelMetadata = provider.GetMetadataForType(modelType);
281
var
modelMetadata = provider.GetMetadataForType(modelType);
302
var
modelMetadata = provider.GetMetadataForType(modelType);
324
var
modelMetadata = provider.GetMetadataForType(modelType);
ModelBinding\ModelMetadataTest.cs (3)
548
public override
ModelMetadata
ElementMetadata
764
public override
ModelMetadata
BoundConstructor => throw new NotImplementedException();
768
public override IReadOnlyList<
ModelMetadata
> BoundConstructorParameters => throw new NotImplementedException();
ModelBinding\ModelStateDictionaryTest.cs (17)
327
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
757
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
816
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
860
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
890
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
918
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
980
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
1004
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
1032
var
metadata = provider.GetMetadataForParameter(parameter);
1058
var
metadata = provider.GetMetadataForType(typeof(int));
1094
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
1119
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
1148
var
metadata = provider.GetMetadataForParameter(parameter);
1175
var
metadata = provider.GetMetadataForType(typeof(int));
1194
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
1248
var
metadata = provider.GetMetadataForType(typeof(int));
1268
var
metadata = provider.GetMetadataForType(typeof(int));
Microsoft.AspNetCore.Mvc.ApiExplorer (10)
DefaultApiDescriptionProvider.cs (8)
171
ModelMetadata
metadata;
201
var
modelMetadata = context.MetadataProvider.GetMetadataForProperty(
514
public
ModelMetadata
ModelMetadata { get; }
525
ModelMetadata
metadata,
580
var
modelMetadata = bindingContext.ModelMetadata;
631
var
propertyMetadata = metadataProperties[i];
669
private static Type GetModelType(
ModelMetadata
metadata)
694
public PropertyKey(
ModelMetadata
metadata, BindingSource? source)
EndpointModelMetadata.cs (2)
28
public override
ModelMetadata
? ElementMetadata { get; }
44
public override ModelPropertyCollection Properties { get; } = new(Enumerable.Empty<
ModelMetadata
>());
Microsoft.AspNetCore.Mvc.Core (294)
ApiBehaviorOptions.cs (2)
43
/// Parameters that are complex (<see cref="
ModelMetadata
.IsComplexType"/>) and are registered in the DI Container (<see cref="IServiceCollection"/>) are assumed to be bound from the services <see cref="BindingSource.Services"/>, unless this
45
/// Parameters that are complex (<see cref="
ModelMetadata
.IsComplexType"/>) are assumed to be bound from the body (<see cref="BindingSource.Body"/>).
ApplicationModels\DefaultApplicationModelProvider.cs (2)
219
var
modelMetadata = _modelMetadataProvider.GetMetadataForProperty(declaringType, propertyInfo.Name);
443
var
modelMetadata = modelMetadataProviderBase.GetMetadataForParameter(parameterInfo);
ApplicationModels\InferParameterBindingInfoConvention.cs (5)
20
/// <item>A complex type parameter (<see cref="
ModelMetadata
.IsComplexType"/>), registered in the DI container, is assigned <see cref="BindingSource.Services"/>.</item>
21
/// <item>A complex type parameter (<see cref="
ModelMetadata
.IsComplexType"/>), not registered in the DI container, is assigned <see cref="BindingSource.Body"/>.</item>
116
if (IsComplexTypeParameter(parameter, out
var
metadata))
172
private bool IsComplexTypeParameter(ParameterModel parameter, out
ModelMetadata
metadata)
189
var
metadata = modelMetadataProvider.GetMetadataForParameter(parameter.ParameterInfo);
BindAttribute.cs (4)
16
private static readonly Func<
ModelMetadata
, bool> _default = (m) => true;
18
private Func<
ModelMetadata
, bool>? _propertyFilter;
52
public Func<
ModelMetadata
, bool> PropertyFilter
66
bool PropertyFilter(
ModelMetadata
modelMetadata)
ControllerBase.cs (3)
2644
Func<
ModelMetadata
, bool> propertyFilter)
2718
Func<
ModelMetadata
, bool> propertyFilter)
2788
Func<
ModelMetadata
, bool> propertyFilter)
Controllers\ControllerBinderDelegateProvider.cs (6)
66
var
modelMetadata = bindingInfo.ModelMetadata;
92
var
modelMetadata = bindingInfo.ModelMetadata;
132
ModelMetadata
metadata;
178
var
metadata = modelMetadataProvider.GetMetadataForProperty(controllerType, property.Name);
194
public BinderItem(IModelBinder modelBinder,
ModelMetadata
modelMetadata)
202
public
ModelMetadata
ModelMetadata { get; }
ModelBinding\Binders\ArrayModelBinder.cs (2)
39
/// <see cref="
ModelMetadata
.IsBindingRequired"/> is <see langword="true"/> for a top-level model, the binder
64
/// <see cref="
ModelMetadata
.IsBindingRequired"/> is <see langword="true"/> for a top-level model, the binder
ModelBinding\Binders\CollectionModelBinder.cs (7)
49
/// <see cref="
ModelMetadata
.IsBindingRequired"/> is <see langword="true"/> for a top-level model, the binder
74
/// <see cref="
ModelMetadata
.IsBindingRequired"/> is <see langword="true"/> for a top-level model, the binder
206
/// <see cref="
ModelMetadata
.IsBindingRequired" />.
213
/// <see cref="
ModelMetadata
.IsBindingRequired" /> failure for collections. Add the error here.
217
var
modelMetadata = bindingContext.ModelMetadata;
269
var
elementMetadata = bindingContext.ModelMetadata.ElementMetadata!;
342
var
elementMetadata = bindingContext.ModelMetadata.ElementMetadata!;
ModelBinding\Binders\ComplexObjectModelBinder.cs (19)
33
private readonly IDictionary<
ModelMetadata
, IModelBinder> _propertyBinders;
39
IDictionary<
ModelMetadata
, IModelBinder> propertyBinders,
74
var
modelMetadata = bindingContext.ModelMetadata;
75
var
boundConstructor = modelMetadata.BoundConstructor;
158
internal static bool CreateModel(ModelBindingContext bindingContext,
ModelMetadata
boundConstructor, object[] values)
193
var
metadata = bindingContext.ModelMetadata;
225
IReadOnlyList<
ModelMetadata
> parameters,
239
var
parameter = parameters[i];
294
var
parameter = parameters[i];
322
IReadOnlyList<
ModelMetadata
> boundProperties)
335
var
property = boundProperties[i];
386
var
property = boundProperties[i];
406
internal static bool CanBindItem(ModelBindingContext bindingContext,
ModelMetadata
propertyMetadata)
435
ModelMetadata
property,
480
ModelMetadata
parameter,
544
var
modelMetadata = bindingContext.ModelMetadata;
580
var
propertyMetadata = bindingContext.ModelMetadata.Properties[i];
616
var
parameterMetadata = parameters[i];
687
ModelMetadata
propertyMetadata,
ModelBinding\Binders\ComplexObjectModelBinderProvider.cs (4)
21
var
metadata = context.Metadata;
28
var propertyBinders = new Dictionary<
ModelMetadata
, IModelBinder>();
31
var
property = context.Metadata.Properties[i];
43
var
boundConstructor = context.Metadata.BoundConstructor;
ModelBinding\Binders\ComplexTypeModelBinder.cs (15)
34
private readonly IDictionary<
ModelMetadata
, IModelBinder> _propertyBinders;
46
IDictionary<
ModelMetadata
, IModelBinder> propertyBinders,
61
/// <see cref="
ModelMetadata
.IsBindingRequired"/> is <see langword="true"/> for a top-level model, the binder
66
IDictionary<
ModelMetadata
, IModelBinder> propertyBinders,
105
var
modelMetadata = bindingContext.ModelMetadata;
111
var
property = modelMetadata.Properties[i];
161
var
property = modelMetadata.Properties[i];
228
/// <param name="propertyMetadata">The <see cref="
ModelMetadata
"/> for the model property.</param>
230
protected virtual bool CanBindProperty(ModelBindingContext bindingContext,
ModelMetadata
propertyMetadata)
258
ModelMetadata
property,
381
var
propertyMetadata = bindingContext.ModelMetadata.Properties[i];
423
internal static bool CanUpdatePropertyInternal(
ModelMetadata
propertyMetadata)
482
var
metadata = bindingContext.ModelMetadata;
516
/// <param name="propertyMetadata">The <see cref="
ModelMetadata
"/> for the property to set.</param>
521
ModelMetadata
propertyMetadata,
ModelBinding\Binders\ComplexTypeModelBinderProvider.cs (2)
24
var propertyBinders = new Dictionary<
ModelMetadata
, IModelBinder>();
27
var
property = context.Metadata.Properties[i];
ModelBinding\Binders\DateTimeModelBinder.cs (1)
53
var
metadata = bindingContext.ModelMetadata;
ModelBinding\Binders\DecimalModelBinder.cs (1)
55
var
metadata = bindingContext.ModelMetadata;
ModelBinding\Binders\DictionaryModelBinder.cs (6)
44
/// <see cref="
ModelMetadata
.IsBindingRequired"/> is <see langword="true"/> for a top-level model, the binder
52
/// <see cref="
ModelMetadata
.IsBindingRequired"/>.
78
/// <see cref="
ModelMetadata
.IsBindingRequired"/> is <see langword="true"/> for a top-level model, the binder
89
/// <see cref="
ModelMetadata
.IsBindingRequired"/>.
158
var
elementMetadata = bindingContext.ModelMetadata.ElementMetadata!;
159
var
valueMetadata = elementMetadata.Properties[nameof(KeyValuePair<TKey, TValue>.Value)]!;
ModelBinding\Binders\DoubleModelBinder.cs (1)
55
var
metadata = bindingContext.ModelMetadata;
ModelBinding\Binders\FloatModelBinder.cs (1)
55
var
metadata = bindingContext.ModelMetadata;
ModelBinding\Binders\HeaderModelBinderProvider.cs (3)
28
var
modelMetadata = context.Metadata;
59
private static bool IsSimpleType(
ModelMetadata
modelMetadata)
61
var
metadata = modelMetadata.ElementMetadata ?? modelMetadata;
ModelBinding\Binders\KeyValuePairModelBinder.cs (1)
96
var
propertyModelMetadata = bindingContext.ModelMetadata.Properties[propertyName]!;
ModelBinding\Binders\KeyValuePairModelBinderProvider.cs (2)
27
var
keyMetadata = context.MetadataProvider.GetMetadataForType(typeArguments[0]);
30
var
valueMetadata = context.MetadataProvider.GetMetadataForType(typeArguments[1]);
ModelBinding\Binders\TryParseModelBinder.cs (1)
110
var tryParseMethodExpession =
ModelMetadata
.FindTryParseMethod(modelType)
ModelBinding\DefaultModelBindingContext.cs (6)
59
public override
ModelMetadata
ModelMetadata
137
public override Func<
ModelMetadata
, bool>? PropertyFilter
200
ModelMetadata
metadata,
246
ModelMetadata
modelMetadata,
327
public
ModelMetadata
ModelMetadata;
331
public Func<
ModelMetadata
, bool>? PropertyFilter;
ModelBinding\DefaultPropertyFilterProvider.cs (3)
19
private static readonly Func<
ModelMetadata
, bool> _default = (m) => true;
33
public virtual Func<
ModelMetadata
, bool> PropertyFilter
47
private static Func<
ModelMetadata
, bool> GetPropertyFilterFromExpression(
ModelBinding\Metadata\BindingMetadata.cs (10)
13
/// Binding metadata details for a <see cref="
ModelMetadata
"/>.
22
/// See <see cref="
ModelMetadata
.BindingSource"/>.
28
/// See <see cref="
ModelMetadata
.BinderModelName"/>.
34
/// model. See <see cref="
ModelMetadata
.BinderType"/>.
61
/// See <see cref="
ModelMetadata
.IsBindingAllowed"/>.
68
/// See <see cref="
ModelMetadata
.IsBindingRequired"/>.
75
/// <see cref="
ModelMetadata
.IsReadOnly"/> will be computed based on the accessibility
76
/// of the property accessor and model <see cref="Type"/>. See <see cref="
ModelMetadata
.IsReadOnly"/>.
82
/// <see cref="
ModelMetadata
.ModelBindingMessageProvider"/>.
98
/// See <see cref="
ModelMetadata
.PropertyFilterProvider"/>.
ModelBinding\Metadata\BindingMetadataProviderContext.cs (2)
16
/// <param name="key">The <see cref="ModelMetadataIdentity"/> for the <see cref="
ModelMetadata
"/>.</param>
17
/// <param name="attributes">The attributes for the <see cref="
ModelMetadata
"/>.</param>
ModelBinding\Metadata\DefaultBindingMetadataProvider.cs (2)
177
public Func<
ModelMetadata
, bool> PropertyFilter => CreatePropertyFilter();
179
private Func<
ModelMetadata
, bool> CreatePropertyFilter()
ModelBinding\Metadata\DefaultMetadataDetails.cs (6)
50
/// Gets or sets the <see cref="
ModelMetadata
"/> entries for the model properties.
52
public
ModelMetadata
[]? Properties { get; set; }
55
/// Gets or sets the <see cref="
ModelMetadata
"/> entries for constructor parameters.
57
public
ModelMetadata
[]? BoundConstructorParameters { get; set; }
80
/// Gets or sets the <see cref="
ModelMetadata
"/> of the container type.
82
public
ModelMetadata
? ContainerMetadata { get; set; }
ModelBinding\Metadata\DefaultModelMetadata.cs (13)
14
/// A default <see cref="
ModelMetadata
"/> implementation.
27
private
ModelMetadata
? _elementMetadata;
28
private
ModelMetadata
? _constructorMetadata;
82
public override
ModelMetadata
? ContainerMetadata => _details.ContainerMetadata;
216
public override
ModelMetadata
? ElementMetadata
376
public override
ModelMetadata
? BoundConstructor
396
public override IReadOnlyList<
ModelMetadata
>? BoundConstructorParameters => _details.BoundConstructorParameters;
462
internal static bool CalculateHasValidators(HashSet<DefaultModelMetadata> visited,
ModelMetadata
metadata)
511
var parameters = defaultModelMetadata.BoundConstructor?.BoundConstructorParameters ?? Array.Empty<
ModelMetadata
>();
512
foreach (
var
parameter in parameters)
520
foreach (
var
property in defaultModelMetadata.BoundProperties)
559
public override
ModelMetadata
GetMetadataForType(Type modelType)
565
public override IEnumerable<
ModelMetadata
> GetMetadataForProperties(Type modelType)
ModelBinding\Metadata\DefaultModelMetadataProvider.cs (15)
72
public override IEnumerable<
ModelMetadata
> GetMetadataForProperties(Type modelType)
85
var properties = new
ModelMetadata
[propertyDetails.Length];
99
public override
ModelMetadata
GetMetadataForParameter(ParameterInfo parameter)
103
public override
ModelMetadata
GetMetadataForParameter(ParameterInfo parameter, Type modelType)
114
public override
ModelMetadata
GetMetadataForType(Type modelType)
124
public override
ModelMetadata
GetMetadataForProperty(PropertyInfo propertyInfo, Type modelType)
135
public override
ModelMetadata
GetMetadataForConstructor(ConstructorInfo constructorInfo, Type modelType)
211
var
metadata = CreateModelMetadata(details);
235
var parameterMetadata = new
ModelMetadata
[parameters.Length];
306
/// Creates a new <see cref="
ModelMetadata
"/> from a <see cref="DefaultMetadataDetails"/>.
309
/// <returns>A new <see cref="
ModelMetadata
"/> instance.</returns>
312
/// <see cref="DefaultModelMetadata"/> .Override this method to create a <see cref="
ModelMetadata
"/>
315
protected virtual
ModelMetadata
CreateModelMetadata(DefaultMetadataDetails entry)
418
public ModelMetadataCacheEntry(
ModelMetadata
metadata, DefaultMetadataDetails details)
424
public
ModelMetadata
Metadata { get; }
ModelBinding\Metadata\DisplayMetadata.cs (29)
9
/// Display metadata details for a <see cref="
ModelMetadata
"/>.
18
/// Gets a set of additional values. See <see cref="
ModelMetadata
.AdditionalValues"/>
25
/// <see cref="
ModelMetadata
.ConvertEmptyStringToNull"/>
31
/// See <see cref="
ModelMetadata
.DataTypeName"/>
37
/// model description. See <see cref="
ModelMetadata
.Description"/>.
43
/// See <see cref="
ModelMetadata
.DisplayFormatString"/>
62
/// <see cref="
ModelMetadata
.DisplayFormatString"/>.
83
/// display name of the model. See <see cref="
ModelMetadata
.DisplayName"/>.
89
/// See <see cref="
ModelMetadata
.EditFormatString"/>
115
/// <see cref="
ModelMetadata
.EditFormatString"/>.
142
/// <see cref="
ModelMetadata
.UnderlyingOrModelType"/>. See
143
/// <see cref="
ModelMetadata
.EnumGroupedDisplayNamesAndValues"/>.
149
/// <see cref="
ModelMetadata
.UnderlyingOrModelType"/>. See <see cref="
ModelMetadata
.EnumNamesAndValues"/>.
156
/// See <see cref="
ModelMetadata
.HasNonDefaultEditFormat"/>
162
/// See <see cref="
ModelMetadata
.HideSurroundingHtml"/>
168
/// See <see cref="
ModelMetadata
.HtmlEncode"/>
173
/// Gets a value indicating whether <see cref="
ModelMetadata
.UnderlyingOrModelType"/> is for an
174
/// <see cref="System.Enum"/>. See <see cref="
ModelMetadata
.IsEnum"/>.
180
/// Gets a value indicating whether <see cref="
ModelMetadata
.UnderlyingOrModelType"/> is for an
182
/// <see cref="
ModelMetadata
.IsFlagsEnum"/>.
189
/// See <see cref="
ModelMetadata
.NullDisplayText"/>
208
/// See <see cref="
ModelMetadata
.NullDisplayText"/>.
229
/// See <see cref="
ModelMetadata
.Order"/>
235
/// model's placeholder text. See <see cref="
ModelMetadata
.Placeholder"/>.
241
/// See <see cref="
ModelMetadata
.ShowForDisplay"/>
247
/// See <see cref="
ModelMetadata
.ShowForEdit"/>
253
/// See <see cref="
ModelMetadata
.SimpleDisplayProperty"/>
259
/// See <see cref="
ModelMetadata
.TemplateHint"/>
ModelBinding\Metadata\DisplayMetadataProviderContext.cs (2)
16
/// <param name="key">The <see cref="ModelMetadataIdentity"/> for the <see cref="
ModelMetadata
"/>.</param>
17
/// <param name="attributes">The attributes for the <see cref="
ModelMetadata
"/>.</param>
ModelBinding\Metadata\ExcludeBindingMetadataProvider.cs (2)
9
/// An <see cref="IBindingMetadataProvider"/> which configures <see cref="
ModelMetadata
.IsBindingAllowed"/> to
21
/// <see cref="
ModelMetadata
.IsBindingAllowed"/> set to <c>false</c>.
ModelBinding\Metadata\ValidationMetadata.cs (7)
11
/// Validation metadata details for a <see cref="
ModelMetadata
"/>.
18
/// <see cref="
ModelMetadata
.IsRequired"/> will be computed based on the model <see cref="System.Type"/>.
19
/// See <see cref="
ModelMetadata
.IsRequired"/>.
25
/// should be validated. See <see cref="
ModelMetadata
.PropertyValidationFilter"/>.
31
/// then <see cref="
ModelMetadata
.ValidateChildren"/> will be <c>true</c> if either of
32
/// <see cref="
ModelMetadata
.IsComplexType"/> or <see cref="
ModelMetadata
.IsEnumerableType"/> is <c>true</c>;
ModelBinding\Metadata\ValidationMetadataProviderContext.cs (2)
16
/// <param name="key">The <see cref="ModelMetadataIdentity"/> for the <see cref="
ModelMetadata
"/>.</param>
17
/// <param name="attributes">The attributes for the <see cref="
ModelMetadata
"/>.</param>
ModelBinding\ModelBinderFactory.cs (9)
174
private void AddToCache(
ModelMetadata
metadata, object? cacheToken, IModelBinder binder)
187
private bool TryGetCachedBinder(
ModelMetadata
metadata, object? cacheToken, [NotNullWhen(true)] out IModelBinder? binder)
229
ModelMetadata
metadata,
242
public override
ModelMetadata
Metadata { get; }
250
public override IModelBinder CreateBinder(
ModelMetadata
metadata)
258
public override IModelBinder CreateBinder(
ModelMetadata
metadata, BindingInfo bindingInfo)
266
var
token = metadata;
282
private readonly
ModelMetadata
_metadata;
285
public Key(
ModelMetadata
metadata, object? token)
ModelBinding\ModelBinderFactoryContext.cs (2)
19
/// Gets or sets the <see cref="
ModelMetadata
"/>.
21
public
ModelMetadata
Metadata { get; set; } = default!;
ModelBinding\ModelBindingHelper.cs (11)
131
Func<
ModelMetadata
, bool> propertyFilter)
212
Func<
ModelMetadata
, bool> propertyFilter)
232
var
modelMetadata = metadataProvider.GetMetadataForType(modelType);
327
public static Expression<Func<
ModelMetadata
, bool>> GetPropertyFilterExpression<TModel>(
346
return Expression.Lambda<Func<
ModelMetadata
, bool>>(orWrapperExpression, firstExpression.Parameters);
349
private static Expression<Func<
ModelMetadata
, bool>> GetPredicateExpression<TModel>(
358
/// Clears <see cref="ModelStateDictionary"/> entries for <see cref="
ModelMetadata
"/>.
378
/// Clears <see cref="ModelStateDictionary"/> entries for <see cref="
ModelMetadata
"/>.
380
/// <param name="modelMetadata">The <see cref="
ModelMetadata
"/>.</param>
384
ModelMetadata
modelMetadata,
417
var
property = modelMetadata.Properties[i];
ModelBinding\ModelMetadataProviderExtensions.cs (6)
16
/// Gets a <see cref="
ModelMetadata
"/> for property identified by the provided
19
/// <param name="provider">The <see cref="
ModelMetadata
"/>.</param>
22
/// <returns>A <see cref="
ModelMetadata
"/> for the property.</returns>
23
public static
ModelMetadata
GetMetadataForProperty(
32
var
containerMetadata = provider.GetMetadataForType(containerType);
34
var
propertyMetadata = containerMetadata.Properties[propertyName];
ModelBinding\ObjectModelValidator.cs (7)
51
var
metadata = model == null ? null : _modelMetadataProvider.GetMetadataForType(model.GetType());
58
/// <see cref="
ModelMetadata
.IsRequired"/> is <see langword="true"/>, will add one or more
66
/// <param name="metadata">The <see cref="
ModelMetadata
"/>.</param>
72
ModelMetadata
metadata)
78
/// <see cref="
ModelMetadata
.IsRequired"/> is <see langword="true"/>, will add one or more
86
/// <param name="metadata">The <see cref="
ModelMetadata
"/>.</param>
93
ModelMetadata
metadata,
ModelBinding\ParameterBinder.cs (6)
61
/// <param name="metadata">The <see cref="
ModelMetadata
"/>.</param>
69
ModelMetadata
metadata,
80
/// <param name="metadata">The <see cref="
ModelMetadata
"/>.</param>
89
ModelMetadata
metadata,
175
ModelMetadata
metadata,
235
ref
ModelMetadata
metadata)
ModelBinding\ParameterBinder.Log.cs (5)
18
ModelMetadata
modelMetadata)
64
ModelMetadata
modelMetadata)
110
ModelMetadata
modelMetadata)
157
ModelMetadata
modelMetadata)
207
ModelMetadata
modelMetadata)
ModelBinding\PropertyValueSetter.cs (1)
16
ModelMetadata
metadata,
ModelBinding\SuppressChildValidationMetadataProvider.cs (3)
12
/// An <see cref="IValidationMetadataProvider"/> which configures <see cref="
ModelMetadata
.ValidateChildren"/> to
22
/// <see cref="
ModelMetadata
.ValidateChildren"/> set to <c>false</c>.
36
/// <see cref="
ModelMetadata
.ValidateChildren"/> set to <c>false</c>.
ModelBinding\Validation\ClientValidatorCache.cs (6)
17
private readonly ConcurrentDictionary<
ModelMetadata
, CacheEntry> _cacheEntries = new ConcurrentDictionary<
ModelMetadata
, CacheEntry>();
22
/// <param name="metadata">The <see cref="
ModelMetadata
"/> being validated.</param>
25
public IReadOnlyList<IClientModelValidator> GetValidators(
ModelMetadata
metadata, IClientModelValidatorProvider validatorProvider)
76
private static IReadOnlyList<IClientModelValidator> GetValidatorsFromEntry(CacheEntry entry,
ModelMetadata
metadata, IClientModelValidatorProvider validationProvider)
104
private static void ExecuteProvider(IClientModelValidatorProvider validatorProvider,
ModelMetadata
metadata, List<ClientValidatorItem> items)
ModelBinding\Validation\DefaultCollectionValidationStrategy.cs (5)
37
/// <see cref="
ModelMetadata
.ElementMetadata"/>. The indices of the elements in the collection are used to
57
ModelMetadata
metadata,
65
public IEnumerator GetEnumeratorForElementType(
ModelMetadata
metadata, object model)
92
private readonly
ModelMetadata
_metadata;
99
ModelMetadata
metadata,
ModelBinding\Validation\DefaultComplexObjectValidationStrategy.cs (9)
27
ModelMetadata
metadata,
39
private readonly
ModelMetadata
_modelMetadata;
40
private readonly IReadOnlyList<
ModelMetadata
> _parameters;
41
private readonly IReadOnlyList<
ModelMetadata
> _properties;
47
ModelMetadata
modelMetadata,
57
_parameters = Array.Empty<
ModelMetadata
>();
86
var
parameter = _parameters[_index];
107
var
property = _properties[_index - _parameters.Count];
134
private static object? GetModel(object container,
ModelMetadata
property)
ModelBinding\Validation\DefaultModelValidatorProvider.cs (1)
13
/// instances in <see cref="ModelBinding.
ModelMetadata
.ValidatorMetadata"/>.
ModelBinding\Validation\ExplicitIndexCollectionValidationStrategy.cs (4)
27
/// <see cref="
ModelMetadata
.ElementMetadata"/>. The keys captured during model binding are mapped to the elements
50
ModelMetadata
metadata,
61
private readonly
ModelMetadata
_metadata;
68
ModelMetadata
metadata,
ModelBinding\Validation\IMetadataBasedModelValidatorProvider.cs (3)
12
/// exclusively using values in <see cref="
ModelMetadata
.ValidatorMetadata"/> or the model type.
15
/// <see cref="
ModelMetadata
"/> instance can incur any validation. The value for <see cref="
ModelMetadata
.HasValidators"/>
ModelBinding\Validation\ShortFormDictionaryValidationStrategy.cs (6)
32
private readonly
ModelMetadata
_valueMetadata;
41
/// The <see cref="
ModelMetadata
"/> associated with <typeparamref name="TValue"/>.
45
ModelMetadata
valueMetadata)
58
ModelMetadata
metadata,
68
private readonly
ModelMetadata
_metadata;
75
ModelMetadata
metadata,
ModelBinding\Validation\ValidationVisitor.cs (13)
100
protected
ModelMetadata
? Metadata { get; set; }
114
/// When not <see langword="null"/>, <see cref="Visit(
ModelMetadata
, string, object)"/> will throw if
140
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with the model.</param>
144
public bool Validate(
ModelMetadata
metadata, string key, object model)
152
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with the model.</param>
157
public virtual bool Validate(
ModelMetadata
? metadata, string? key, object? model, bool alwaysValidateAtTopLevel)
163
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with the model.</param>
169
public virtual bool Validate(
ModelMetadata
? metadata, string? key, object? model, bool alwaysValidateAtTopLevel, object? container)
269
protected virtual bool Visit(
ModelMetadata
metadata, string? key, object? model)
292
private bool VisitImplementation(ref
ModelMetadata
metadata, ref string? key, object? model)
436
var
metadata = entry.Metadata;
497
private readonly
ModelMetadata
_metadata;
513
ModelMetadata
metadata,
ModelBinding\Validation\ValidatorCache.cs (4)
16
private readonly ConcurrentDictionary<
ModelMetadata
, CacheEntry> _cacheEntries = new();
24
public IReadOnlyList<IModelValidator> GetValidators(
ModelMetadata
metadata, IModelValidatorProvider validatorProvider)
66
private static IReadOnlyList<IModelValidator> GetValidatorsFromEntry(CacheEntry entry,
ModelMetadata
metadata, IModelValidatorProvider validationProvider)
94
private static void ExecuteProvider(IModelValidatorProvider validatorProvider,
ModelMetadata
metadata, List<ValidatorItem> items)
MvcCoreLoggerExtensions.cs (3)
120
var
modelMetadata = bindingContext.ModelMetadata;
175
var
modelMetadata = bindingContext.ModelMetadata;
215
var
modelMetadata = bindingContext.ModelMetadata;
MvcOptions.cs (3)
169
/// <see cref="
ModelMetadata
.ModelBindingMessageProvider"/> property of all <see cref="
ModelMetadata
"/>
176
/// create <see cref="
ModelMetadata
"/> instances.
Microsoft.AspNetCore.Mvc.Core.Test (256)
ApplicationModels\InferParameterBindingInfoConventionTest.cs (2)
1138
public static Func<
ModelMetadata
, bool> PropertyFilterStatic => (c) => true;
1142
public Func<
ModelMetadata
, bool> PropertyFilter => PropertyFilterStatic;
BindAttributeTest.cs (1)
30
context.ModelMetadata = new Mock<
ModelMetadata
>(identity).Object;
ControllerBaseTest.cs (4)
2721
Func<
ModelMetadata
, bool> propertyFilter = (m) =>
2754
Func<
ModelMetadata
, bool> propertyFilter = (m) =>
2865
var
modelMetadata = context.ModelMetadata.Properties[propertyName];
2903
Func<
ModelMetadata
, bool> propertyFilter = (m) =>
Controllers\ControllerBinderDelegateProviderTest.cs (2)
1148
It.IsAny<
ModelMetadata
>(),
1151
.Returns((ActionContext context, IModelBinder modelBinder, IValueProvider valueProvider, ParameterDescriptor descriptor,
ModelMetadata
metadata, object v, object c) =>
Formatters\InputFormatterTest.cs (9)
38
var
metadata = provider.GetMetadataForType(typeof(void));
72
var
metadata = provider.GetMetadataForType(typeof(void));
103
var
metadata = provider.GetMetadataForType(typeof(void));
137
var
metadata = provider.GetMetadataForType(typeof(void));
168
var
metadata = provider.GetMetadataForType(typeof(void));
205
var
metadata = provider.GetMetadataForType(typeof(void));
235
var
metadata = provider.GetMetadataForType(typeof(void));
273
var
metadata = provider.GetMetadataForType(typeof(void));
302
var
metadata = provider.GetMetadataForType(typeof(void));
Formatters\JsonInputFormatterTestBase.cs (1)
655
var
metadata = provider.GetMetadataForType(modelType);
ModelBinding\Binders\ArrayModelBinderProviderTest.cs (1)
81
var
modelMetadata = metadataProvider.GetMetadataForProperty(
ModelBinding\Binders\CollectionModelBinderTest.cs (1)
484
var
metadata = metadataProvider.GetMetadataForProperty(
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (48)
43
var
modelMetadata = GetMetadataForProperty(typeof(Document), nameof(Document.SubDocument));
100
var
modelMetadata = GetMetadataForProperty(typeof(SimpleContainer), nameof(SimpleContainer.Simple));
285
var
metadata = metadataProvider.GetMetadataForParameter(parameter);
298
var binders = new Dictionary<
ModelMetadata
, IModelBinder>();
299
foreach (
var
property in metadataProvider.GetMetadataForProperties(typeof(Person)))
337
var
metadata = metadataProvider.GetMetadataForParameter(parameter);
349
new Dictionary<
ModelMetadata
, IModelBinder>(),
381
var
metadata = metadataProvider.GetMetadataForParameter(parameter);
393
new Dictionary<
ModelMetadata
, IModelBinder>(),
420
var
metadata = metadataProvider.GetMetadataForProperty(typeof(CollectionContainer), propertyName);
463
var
metadata = GetMetadataForProperty(typeof(PersonWithBindExclusion), property);
490
var
metadata = GetMetadataForProperty(typeof(PersonWithBindExclusion), property);
518
var
metadata = GetMetadataForProperty(typeof(PersonWithBindExclusion), property);
545
var
metadata = GetMetadataForProperty(typeof(TypeWithIncludedPropertiesUsingBindAttribute), property);
571
var
metadata = GetMetadataForProperty(typeof(ModelWithMixedBindingBehaviors), property);
601
var
property = GetMetadataForProperty(model.GetType(), nameof(ModelWithBindRequired.Age));
629
private readonly
ModelMetadata
_modelMetadata;
632
public TestModelBinderProvider(
ModelMetadata
modelMetadata, ModelBindingResult result)
668
var
property = GetMetadataForProperty(model.GetType(), nameof(ModelWithDataMemberIsRequired.Age));
707
var
property = GetMetadataForProperty(model.GetType(), nameof(ModelWithBindRequired.Age));
739
var
property = GetMetadataForProperty(model.GetType(), nameof(BindingOptionalProperty.ValueTypeRequired));
762
var
property = GetMetadataForProperty(model.GetType(), nameof(NullableValueTypeProperty.NullableValueType));
783
var
containerMetadata = GetMetadataForType(model.GetType());
787
var
property = GetMetadataForProperty(model.GetType(), nameof(Person.ValueTypeRequired));
808
var
containerMetadata = GetMetadataForType(model.GetType());
812
var
property = GetMetadataForProperty(model.GetType(), nameof(Person.ValueTypeRequired));
838
var
containerMetadata = GetMetadataForType(model.GetType());
844
var
firstNameProperty = containerMetadata.Properties[nameof(model.FirstName)];
847
var
lastNameProperty = containerMetadata.Properties[nameof(model.LastName)];
868
var
metadata = GetMetadataForType(typeof(Person));
869
var
propertyMetadata = metadata.Properties[nameof(model.PropertyWithDefaultValue)];
890
var
metadata = GetMetadataForType(typeof(Person));
891
var
propertyMetadata = metadata.Properties[nameof(model.PropertyWithInitializedValue)];
914
var
metadata = GetMetadataForType(typeof(Person));
915
var
propertyMetadata = metadata.Properties[nameof(model.PropertyWithInitializedValueAndDefault)];
938
var
metadata = GetMetadataForType(typeof(Person));
939
var
propertyMetadata = metadata.Properties[nameof(model.NonUpdateableProperty)];
981
var
propertyMetadata = bindingContext.ModelMetadata.Properties[propertyName];
1002
var
modelMetadata = GetMetadataForType(model.GetType());
1003
var
propertyMetadata = GetMetadataForProperty(model.GetType(), nameof(CollectionContainer.ReadOnlyList));
1024
var
propertyMetadata = bindingContext.ModelMetadata.Properties[nameof(model.DateOfBirth)];
1048
var
propertyMetadata = bindingContext.ModelMetadata.Properties[nameof(model.DateOfDeath)];
1069
var
propertyMetadata = bindingContext.ModelMetadata.Properties[nameof(model.NameNoAttribute)];
1084
private static ComplexObjectModelBinder CreateBinder(
ModelMetadata
metadata, Action<MvcOptions> configureOptions = null)
1106
private static DefaultModelBindingContext CreateContext(
ModelMetadata
metadata, object model = null)
1122
private static
ModelMetadata
GetMetadataForType(Type type)
1127
private static
ModelMetadata
GetMetadataForProperty(Type type, string propertyName)
1363
public Func<
ModelMetadata
, bool> PropertyFilter
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (65)
42
var
modelMetadata = GetMetadataForProperty(typeof(Document), nameof(Document.SubDocument));
99
var
modelMetadata = GetMetadataForProperty(typeof(SimpleContainer), nameof(SimpleContainer.Simple));
298
var
metadata = metadataProvider.GetMetadataForParameter(parameter);
319
.Setup(o => o.CanBindPropertyPublic(bindingContext, It.IsAny<
ModelMetadata
>()))
345
var
metadata = metadataProvider.GetMetadataForParameter(parameter);
358
var binders = new Dictionary<
ModelMetadata
, IModelBinder>();
359
foreach (
var
property in metadataProvider.GetMetadataForProperties(typeof(Person)))
397
var
metadata = metadataProvider.GetMetadataForParameter(parameter);
409
new Dictionary<
ModelMetadata
, IModelBinder>(),
441
var
metadata = metadataProvider.GetMetadataForParameter(parameter);
453
new Dictionary<
ModelMetadata
, IModelBinder>(),
480
var
propertyMetadata = GetMetadataForProperty(typeof(MyModelTestingCanUpdateProperty), propertyName);
500
var
metadata = metadataProvider.GetMetadataForProperty(typeof(CollectionContainer), propertyName);
556
var
metadata = GetMetadataForType(typeof(ClassWithNoParameterlessConstructor));
644
var
metadata = GetMetadataForProperty(typeof(PersonWithBindExclusion), property);
671
var
metadata = GetMetadataForProperty(typeof(PersonWithBindExclusion), property);
699
var
metadata = GetMetadataForProperty(typeof(PersonWithBindExclusion), property);
726
var
metadata = GetMetadataForProperty(typeof(TypeWithIncludedPropertiesUsingBindAttribute), property);
752
var
metadata = GetMetadataForProperty(typeof(ModelWithMixedBindingBehaviors), property);
782
var
property = GetMetadataForProperty(model.GetType(), nameof(ModelWithBindRequired.Age));
820
var
property = GetMetadataForProperty(model.GetType(), nameof(ModelWithDataMemberIsRequired.Age));
856
var
property = GetMetadataForProperty(model.GetType(), nameof(ModelWithBindRequired.Age));
885
var
property = GetMetadataForProperty(model.GetType(), nameof(BindingOptionalProperty.ValueTypeRequired));
905
var
property = GetMetadataForProperty(model.GetType(), nameof(NullableValueTypeProperty.NullableValueType));
921
var
containerMetadata = GetMetadataForType(model.GetType());
927
var
property = GetMetadataForProperty(model.GetType(), nameof(Person.ValueTypeRequired));
943
var
containerMetadata = GetMetadataForType(model.GetType());
949
var
property = GetMetadataForProperty(model.GetType(), nameof(Person.ValueTypeRequired));
970
var
containerMetadata = GetMetadataForType(model.GetType());
976
foreach (
var
property in containerMetadata.Properties)
981
var
firstNameProperty = containerMetadata.Properties[nameof(model.FirstName)];
984
var
lastNameProperty = containerMetadata.Properties[nameof(model.LastName)];
1003
var
property = GetMetadataForProperty(model.GetType(), nameof(ModelWithPropertyInitializedInConstructor.NameContainer));
1004
var
nestedProperty = GetMetadataForProperty(typeof(ClassWithNoParameterlessConstructor), nameof(ClassWithNoParameterlessConstructor.Name));
1030
var
metadata = GetMetadataForType(typeof(Person));
1031
var
propertyMetadata = metadata.Properties[nameof(model.PropertyWithDefaultValue)];
1052
var
metadata = GetMetadataForType(typeof(Person));
1053
var
propertyMetadata = metadata.Properties[nameof(model.PropertyWithInitializedValue)];
1076
var
metadata = GetMetadataForType(typeof(Person));
1077
var
propertyMetadata = metadata.Properties[nameof(model.PropertyWithInitializedValueAndDefault)];
1100
var
metadata = GetMetadataForType(typeof(Person));
1101
var
propertyMetadata = metadata.Properties[nameof(model.NonUpdateableProperty)];
1143
var
propertyMetadata = bindingContext.ModelMetadata.Properties[propertyName];
1164
var
modelMetadata = GetMetadataForType(model.GetType());
1165
var
propertyMetadata = GetMetadataForProperty(model.GetType(), nameof(CollectionContainer.ReadOnlyList));
1186
var
propertyMetadata = bindingContext.ModelMetadata.Properties[nameof(model.DateOfBirth)];
1210
var
propertyMetadata = bindingContext.ModelMetadata.Properties[nameof(model.DateOfDeath)];
1231
var
propertyMetadata = bindingContext.ModelMetadata.Properties[nameof(model.NameNoAttribute)];
1246
private static TestableComplexTypeModelBinder CreateBinder(
ModelMetadata
metadata)
1270
private static DefaultModelBindingContext CreateContext(
ModelMetadata
metadata, object model = null)
1286
private static
ModelMetadata
GetMetadataForType(Type type)
1291
private static
ModelMetadata
GetMetadataForProperty(Type type, string propertyName)
1538
public Func<
ModelMetadata
, bool> PropertyFilter
1586
var propertyBinders = new Dictionary<
ModelMetadata
, IModelBinder>();
1587
foreach (
var
property in context.Metadata.Properties)
1603
: this(new Dictionary<
ModelMetadata
, IModelBinder>())
1608
: this(new Dictionary<
ModelMetadata
, IModelBinder>(), allowValidatingTopLevelNodes)
1612
public TestableComplexTypeModelBinder(IDictionary<
ModelMetadata
, IModelBinder> propertyBinders)
1618
IDictionary<
ModelMetadata
, IModelBinder> propertyBinders,
1624
public Dictionary<
ModelMetadata
, ModelBindingResult> Results { get; } = new Dictionary<
ModelMetadata
, ModelBindingResult>();
1648
ModelMetadata
propertyMetadata)
1662
ModelMetadata
propertyMetadata)
1680
ModelMetadata
propertyMetadata,
1689
ModelMetadata
propertyMetadata,
ModelBinding\Binders\DictionaryModelBinderTest.cs (3)
342
var
valueMetadata = metadataProvider.GetMetadataForType(typeof(ModelWithProperties));
346
new ComplexObjectModelBinder(new Dictionary<
ModelMetadata
, IModelBinder>()
672
var
metadata = metadataProvider.GetMetadataForProperty(
ModelBinding\Binders\FormFileModelBinderTest.cs (5)
86
var
metadata = new EmptyModelMetadataProvider().GetMetadataForProperty(
128
var
metadata = new EmptyModelMetadataProvider().GetMetadataForProperty(
438
var
metadata = metadataProvider.GetMetadataForProperty(
448
var
metadata = metadataProvider.GetMetadataForType(modelType);
454
ModelMetadata
metadata,
ModelBinding\Binders\HeaderModelBinderTests.cs (4)
329
ModelMetadata
metadata,
375
var
metadata = bindingContext.ModelMetadata;
389
private static
ModelMetadata
GetMetadataForType(Type modelType)
396
private static
ModelMetadata
GetMetadataForReadOnlyArray()
ModelBinding\Binders\ServicesModelBinderTest.cs (1)
37
var
modelMetadata = metadataProvider.GetMetadataForType(modelType);
ModelBinding\Binders\SimpleTypeModelBinderTest.cs (4)
158
public static TheoryData<
ModelMetadata
> IntegerModelMetadataDataSet
166
return new TheoryData<
ModelMetadata
>
177
public async Task BindModel_EmptyValueProviderResult_ReturnsFailedAndLogsSuccessfully(
ModelMetadata
metadata)
262
public async Task BindModel_ValidValueProviderResult_ReturnsModelAndLogsSuccessfully(
ModelMetadata
metadata)
ModelBinding\Binders\TryParseTypeModelBinderTest.cs (4)
107
public static TheoryData<
ModelMetadata
> IntegerModelMetadataDataSet
115
return new TheoryData<
ModelMetadata
>
126
public async Task BindModel_EmptyValueProviderResult_ReturnsFailedAndLogsSuccessfully(
ModelMetadata
metadata)
189
public async Task BindModel_ValidValueProviderResult_ReturnsModelAndLogsSuccessfully(
ModelMetadata
metadata)
ModelBinding\DefaultModelBindingContextTest.cs (3)
37
var
newModelMetadata = metadataProvider.GetMetadataForType(typeof(object));
102
var
propertyMetadata = metadataProvider.GetMetadataForProperty(typeof(string), nameof(string.Length));
131
var
propertyMetadata = metadataProvider.GetMetadataForProperty(typeof(string), nameof(string.Length));
ModelBinding\Metadata\DefaultModelMetadataProviderTest.cs (20)
18
var
metadata = provider.GetMetadataForType(typeof(ModelType));
52
var
metadata1 = provider.GetMetadataForType(typeof(object));
53
var
metadata2 = provider.GetMetadataForType(typeof(object));
158
var
metadata = provider.GetMetadataForProperties(typeof(ModelType)).First();
178
var
propertyMetadata = Assert.Single(metadata);
192
foreach (
var
property in metadata)
209
var
metadata = provider.GetMetadataForParameter(parameters[0]);
228
var
metadata = provider.GetMetadataForParameter(parameters[1]);
257
var
metadata1 = provider.GetMetadataForParameter(parameter);
258
var
metadata2 = provider.GetMetadataForParameter(parameter);
274
var
metadata = provider.GetMetadataForParameter(parameter, typeof(DerivedModelType));
325
var
metadata1 = provider.GetMetadataForParameter(parameter, typeof(DerivedModelType));
326
var
metadata2 = provider.GetMetadataForParameter(parameter, typeof(DerivedModelType));
342
var
metadata1 = provider.GetMetadataForParameter(parameter, typeof(DerivedModelType));
343
var
metadata2 = provider.GetMetadataForParameter(parameter, typeof(object));
358
var
metadata = provider.GetMetadataForProperty(property, typeof(DerivedModelType));
408
var
metadata1 = provider.GetMetadataForProperty(property, typeof(DerivedModelType));
409
var
metadata2 = provider.GetMetadataForProperty(property, typeof(DerivedModelType));
424
var
metadata1 = provider.GetMetadataForProperty(property, typeof(DerivedModelType));
425
var
metadata2 = provider.GetMetadataForProperty(property, typeof(object));
ModelBinding\Metadata\DefaultModelMetadataTest.cs (6)
66
Assert.Equal(10000,
ModelMetadata
.DefaultOrder);
67
Assert.Equal(
ModelMetadata
.DefaultOrder, metadata.Order);
242
var
elementMetadata = metadata.ElementMetadata;
269
var
elementMetadata = metadata.ElementMetadata;
960
var
metadata2 = metadata1.GetMetadataForType(typeof(string));
1076
var propertyMetadata = new Mock<
ModelMetadata
>(propertyIdentity);
ModelBinding\ModelBindingHelperTest.cs (12)
134
Func<
ModelMetadata
, bool> propertyFilter = (m) => true;
183
Func<
ModelMetadata
, bool> propertyFilter = (m) =>
463
Func<
ModelMetadata
, bool> propertyFilter = (m) => true;
513
Func<
ModelMetadata
, bool> propertyFilter = (m) =>
612
Func<
ModelMetadata
, bool> propertyFilter = (m) => true;
641
var
modelMetadata = metadataProvider.GetMetadataForType(typeof(Product));
673
var
modelMetadata = metadataProvider.GetMetadataForType(typeof(string));
697
var
modelMetadata = metadataProvider.GetMetadataForType(typeof(List<Product>));
742
var
modelMetadata = metadataProvider.GetMetadataForType(typeof(Product));
1510
var
modelMetadata = metadataProvider.GetMetadataForProperty(
1524
var
metadata = metadataProvider.GetMetadataForType(modelType);
1529
private static DefaultModelBindingContext GetBindingContext(
ModelMetadata
metadata)
ModelBinding\ParameterBinderTest.cs (12)
123
public static TheoryData<RequiredAttribute, ParameterDescriptor,
ModelMetadata
> EnforcesTopLevelRequiredDataSet
174
return new TheoryData<RequiredAttribute, ParameterDescriptor,
ModelMetadata
>
189
ModelMetadata
metadata)
331
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameter);
386
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameter);
441
var
modelMetadata = modelMetadataProvider.GetMetadataForProperty(property.DeclaringType, property.Name);
495
var
modelMetadata = modelMetadataProvider.GetMetadataForProperty(property.DeclaringType, property.Name);
542
var
modelMetadata = modelMetadataProvider.GetMetadataForType(typeof(IJsonPatchDocument));
604
var
modelMetadata = modelMetadataProvider.GetMetadataForType(typeof(IJsonPatchDocument));
672
var
modelMetadata = modelMetadataProvider.GetMetadataForType(typeof(string));
741
ModelMetadata
modelMetadata,
786
ModelMetadata
modelMetadata,
ModelBinding\TestModelBinderProviderContext.cs (7)
19
private readonly List<Func<
ModelMetadata
, IModelBinder>> _binderCreators =
20
new List<Func<
ModelMetadata
, IModelBinder>>();
59
public override
ModelMetadata
Metadata { get; }
67
public override IModelBinder CreateBinder(
ModelMetadata
metadata)
81
public override IModelBinder CreateBinder(
ModelMetadata
metadata, BindingInfo bindingInfo)
87
public void OnCreatingBinder(Func<
ModelMetadata
, IModelBinder> binderCreator)
92
public void OnCreatingBinder(
ModelMetadata
metadata, Func<IModelBinder> binderCreator)
ModelBinding\UnsupportedContentTypeFilterTest.cs (2)
28
var
modelMetadata = new EmptyModelMetadataProvider()
111
var
modelMetadata = new EmptyModelMetadataProvider()
ModelBinding\Validation\ClientValidatorCacheTest.cs (7)
16
var
metadata = new TestModelMetadataProvider().GetMetadataForProperty(typeof(TypeWithProperty), "Property1");
43
var
metadata = new TestModelMetadataProvider().GetMetadataForProperty(typeof(TypeWithProperty), "Property1");
71
var
metadata = modelMetadataProvider.GetMetadataForType(typeof(TestRecordType));
72
var
property = metadata.Properties[nameof(TestRecordType.Property1)];
73
var
parameter = metadata.BoundConstructor.BoundConstructorParameters.First(f => f.Name == nameof(TestRecordType.Property1));
92
var
metadata = modelMetadataProvider.GetMetadataForType(typeof(TestRecordTypeWithProperty));
93
var
property = metadata.Properties[nameof(TestRecordTypeWithProperty.Property2)];
ModelBinding\Validation\CompositeModelValidatorProviderTest.cs (1)
35
var
modelMetadata = new EmptyModelMetadataProvider().GetMetadataForType(typeof(string));
ModelBinding\Validation\DefaultCollectionValidationStrategyTest.cs (3)
16
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(List<int>));
56
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(List<int>));
91
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(TwiceEnumerable));
ModelBinding\Validation\DefaultComplexObjectValidationStrategyTest.cs (7)
23
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(Person));
63
var
metadata = TestModelMetadataProvider.CreateDefaultProvider(new List<IMetadataDetailsProvider> { new TestValidationModelNameProvider() }).GetMetadataForType(typeof(Person));
97
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(Person));
131
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(LazyPerson));
232
private readonly Func<
ModelMetadata
, bool> _shouldExclude;
234
public ExcludePropertiesDefaultModelMetadataProvider(ICompositeMetadataDetailsProvider detailsProvider, Func<
ModelMetadata
, bool> shouldExclude) : base(detailsProvider)
239
public override IEnumerable<
ModelMetadata
> GetMetadataForProperties(Type modelType)
ModelBinding\Validation\DefaultModelValidatorProviderTest.cs (7)
19
var
metadata = metadataProvider.GetMetadataForType(typeof(ValidatableObject));
39
var
metadata = metadataProvider.GetMetadataForType(typeof(ModelValidatorAttributeOnClass));
59
var
metadata = metadataProvider.GetMetadataForProperty(
81
var
metadata = metadataProvider.GetMetadataForProperty(
104
var
metadata = metadataProvider.GetMetadataForProperty(
126
var
metadata = metadataProvider.GetMetadataForProperty(
170
private static IList<ValidatorItem> GetValidatorItems(
ModelMetadata
metadata)
ModelBinding\Validation\ExplicitIndexCollectionValidationStrategyTest.cs (5)
16
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(List<int>));
56
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(List<int>));
91
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(TwiceEnumerable));
126
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(List<int>));
156
var
metadata = TestModelMetadataProvider.CreateDefaultProvider().GetMetadataForType(typeof(List<int>));
ModelBinding\Validation\ShortFormDictionaryValidationStrategyTest.cs (6)
20
var
metadata = metadataProvider.GetMetadataForType(typeof(List<int>));
21
var
valueMetadata = metadataProvider.GetMetadataForType(typeof(string));
68
var
metadata = metadataProvider.GetMetadataForType(typeof(List<int>));
69
var
valueMetadata = metadataProvider.GetMetadataForType(typeof(string));
108
var
metadata = metadataProvider.GetMetadataForType(typeof(List<int>));
109
var
valueMetadata = metadataProvider.GetMetadataForType(typeof(string));
ModelBinding\Validation\ValidatorCacheTest.cs (2)
16
var
metadata = new TestModelMetadataProvider().GetMetadataForProperty(typeof(TypeWithProperty), "Property1");
43
var
metadata = new TestModelMetadataProvider().GetMetadataForProperty(typeof(TypeWithProperty), "Property1");
ValidationProblemDetailsTest.cs (1)
56
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
Microsoft.AspNetCore.Mvc.DataAnnotations (6)
CompareAttributeAdapter.cs (1)
88
var
otherProperty = validationContext.MetadataProvider.GetMetadataForProperty(
DataAnnotationsModelValidator.cs (1)
70
var
metadata = validationContext.ModelMetadata;
DefaultClientModelValidatorProvider.cs (1)
13
/// <see cref="IClientModelValidator"/> instances in <see cref="ModelBinding.
ModelMetadata
.ValidatorMetadata"/>.
NumericClientModelValidator.cs (1)
32
private static string GetErrorMessage(
ModelMetadata
modelMetadata)
ValidationAttributeAdapterOfTAttribute.cs (2)
61
/// <param name="modelMetadata">The <see cref="
ModelMetadata
"/> associated with the model annotated with
65
protected virtual string GetErrorMessage(
ModelMetadata
modelMetadata, params object[] arguments)
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (127)
CompareAttributeAdapterTest.cs (6)
21
var
metadata = metadataProvider.GetMetadataForProperty(typeof(PropertyDisplayNameModel), "MyProperty");
56
var
metadata = metadataProvider.GetMetadataForProperty(typeof(PropertyDisplayNameModel), "MyProperty");
99
var
metadata = metadataProvider.GetMetadataForProperty(typeof(PropertyNameModel), "MyProperty");
133
var
metadata = metadataProvider.GetMetadataForProperty(typeof(PropertyNameModel), "MyProperty");
172
var
metadata = metadataProvider.GetMetadataForProperty(typeof(PropertyNameModel), "MyProperty");
211
var
metadata = metadataProvider.GetMetadataForProperty(typeof(PropertyNameModel), "MyProperty");
DataAnnotationsClientModelValidatorProviderTest.cs (6)
24
var
metadata = _metadataProvider.GetMetadataForProperty(
47
var
metadata = _metadataProvider.GetMetadataForProperty(
78
var
metadata = _metadataProvider.GetMetadataForProperty(
100
var
metadata = _metadataProvider.GetMetadataForProperty(
123
var
metadata = _metadataProvider.GetMetadataForType(typeof(DummyClassWithDummyValidationAttribute));
135
private IList<ClientValidatorItem> GetValidatorItems(
ModelMetadata
metadata)
DataAnnotationsModelValidatorProviderTest.cs (5)
25
var
metadata = _metadataProvider.GetMetadataForType(mockValidatable.GetType());
44
var
metadata = _metadataProvider.GetMetadataForProperty(
67
var
metadata = _metadataProvider.GetMetadataForType(typeof(DummyClassWithDummyValidationAttribute));
99
var
metadata = _metadataProvider.GetMetadataForType(mockValidatable.Object.GetType());
160
private IList<ValidatorItem> GetValidatorItems(
ModelMetadata
metadata)
DataAnnotationsModelValidatorTest.cs (11)
35
public static TheoryData<
ModelMetadata
, object, object, string> Validate_SetsMemberName_AsExpectedData
46
return new TheoryData<
ModelMetadata
, object, object, string>
89
ModelMetadata
metadata,
127
var
metadata = _metadataProvider.GetMetadataForType(typeof(string));
156
var
metadata = _metadataProvider.GetMetadataForProperty(typeof(string), "Length");
187
var
metadata = _metadataProvider.GetMetadataForType(typeof(string));
217
var
metadata = _metadataProvider.GetMetadataForProperty(typeof(string), "Length");
242
var
metadata = _metadataProvider.GetMetadataForProperty(typeof(string), "Length");
334
var
metadata = _metadataProvider.GetMetadataForProperty(typeof(string), nameof(string.Length));
365
var
metadata = _metadataProvider.GetMetadataForType(typeof(string));
523
var
metadata = _metadataProvider.GetMetadataForType(typeof(SampleModel));
DataTypeClientModelValidatorProviderTest.cs (4)
24
var
metadata = _metadataProvider.GetMetadataForType(modelType);
41
var
metadata = _metadataProvider.GetMetadataForType(typeof(float));
72
var
metadata = _metadataProvider.GetMetadataForType(modelType);
83
private IList<ClientValidatorItem> GetValidatorItems(
ModelMetadata
metadata)
DefaultModelClientValidatorProviderTest.cs (10)
20
var
metadata = metadataProvider.GetMetadataForType(typeof(ValidatableObject));
40
var
metadata = metadataProvider.GetMetadataForType(typeof(ModelValidatorAttributeOnClass));
61
var
metadata = metadataProvider.GetMetadataForProperty(
83
var
metadata = metadataProvider.GetMetadataForProperty(
107
var
metadata = metadataProvider.GetMetadataForProperty(
130
var
metadata = metadataProvider.GetMetadataForProperty(
151
var
metadata = metadataProvider.GetMetadataForProperty(
174
var
metadata = metadataProvider.GetMetadataForProperty(
190
private IList<ClientValidatorItem> GetClientValidatorItems(
ModelMetadata
metadata)
195
private IList<ValidatorItem> GetValidatorItems(
ModelMetadata
metadata)
FileExtensionsAttributeAdapterTest.cs (4)
23
var
metadata = provider.GetMetadataForProperty(typeof(Profile), nameof(Profile.PhotoFileName));
74
var
metadata = provider.GetMetadataForProperty(typeof(Profile), nameof(Profile.PhotoFileName));
104
var
metadata = provider.GetMetadataForProperty(typeof(Profile), nameof(Profile.PhotoFileName));
138
var
metadata = provider.GetMetadataForProperty(typeof(Profile), "PhotoFileName");
MaxLengthAttributeAdapterTest.cs (5)
21
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
55
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
84
var
metadata = provider.GetMetadataForProperty(typeof(string), propertyName);
111
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
144
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
MinLengthAttributeAdapterTest.cs (4)
21
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
55
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
83
var
metadata = provider.GetMetadataForProperty(typeof(string), propertyName);
111
var
metadata = provider.GetMetadataForProperty(typeof(string), propertyName);
ModelMetadataProviderTest.cs (51)
29
var
metadata = provider.GetMetadataForType(type);
35
foreach (
var
property in metadata.Properties)
54
var
metadata = provider.GetMetadataForType(type);
91
var
metadata = provider.GetMetadataForType(modelType: typeof(ClassWithHiddenProperties));
92
var
property = metadata.Properties["DirectlyHidden"];
106
var
metadata = provider.GetMetadataForType(typeof(ClassWithHiddenProperties));
107
var
property = metadata.Properties["OfHiddenType"];
121
var
metadata = provider.GetMetadataForType(typeof(ClassWithHiddenProperties));
122
var
property = metadata.Properties["DirectlyHidden"];
136
var
metadata = provider.GetMetadataForType(typeof(ClassWithHiddenProperties));
137
var
property = metadata.Properties["OfHiddenType"];
153
var
propertyMetadata = provider.GetMetadataForProperty(typeof(Person), nameof(Person.Parent));
166
var
propertyMetadata = provider.GetMetadataForProperty(typeof(Person), nameof(Person.GrandParent));
172
public static TheoryData<object, Func<
ModelMetadata
, string>> ExpectedAttributeDataStrings
176
return new TheoryData<object, Func<
ModelMetadata
, string>>
224
public void AttributesOverrideMetadataStrings(object attribute, Func<
ModelMetadata
, string> accessor)
230
var
metadata = provider.GetMetadataForType(typeof(string));
246
var
metadata = provider.GetMetadataForType(typeof(string));
255
public static TheoryData<Attribute, Func<
ModelMetadata
, bool>, bool> ExpectedAttributeDataBooleans
259
return new TheoryData<Attribute, Func<
ModelMetadata
, bool>, bool>
342
Func<
ModelMetadata
, bool> accessor,
348
var
metadata = provider.GetMetadataForProperty(typeof(CoolUser), nameof(CoolUser.Name));
364
new DisplayAttribute(),
ModelMetadata
.DefaultOrder
399
var
metadata = provider.GetMetadataForType(typeof(string));
415
var
metadata = provider.GetMetadataForType(typeof(string));
431
var
metadata = provider.GetMetadataForType(typeof(string));
451
var
metadata = provider.GetMetadataForType(typeof(string));
477
var
metadata = provider.GetMetadataForType(typeof(string));
499
var
metadata = provider.GetMetadataForType(typeof(string));
516
var
metadata = provider.GetMetadataForType(typeof(string));
534
var
metadata = provider.GetMetadataForType(typeof(string));
552
var
metadata = provider.GetMetadataForType(typeof(string));
575
var
metadata = provider.GetMetadataForType(typeof(string));
593
var
metadata = provider.GetMetadataForType(typeof(string));
615
var
metadata = provider.GetMetadataForType(typeof(string));
634
var
metadata = provider.GetMetadataForType(typeof(string));
653
var
metadata = provider.GetMetadataForType(typeof(string));
670
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
687
var
metadata = provider.GetMetadataForProperty(typeof(Person), nameof(Person.Parent));
700
var
metadata = provider.GetMetadataForProperty(
715
var
metadata = metadataProvider.GetMetadataForProperty(
730
var
metadata = metadataProvider.GetMetadataForProperty(
745
var
metadata = metadataProvider.GetMetadataForProperty(
760
var
metadata = metadataProvider.GetMetadataForProperty(
776
var
metadata = metadataProvider.GetMetadataForProperty(
794
var
metadata = metadataProvider.GetMetadataForType(type);
806
var
metadata = metadataProvider.GetMetadataForType(type);
822
var
metadata = metadataProvider.GetMetadataForProperty(type, propertyName);
838
var
metadata = metadataProvider.GetMetadataForProperty(type, propertyName);
854
var
metadata = metadataProvider.GetMetadataForProperty(type, propertyName);
870
var
metadata = metadataProvider.GetMetadataForProperty(type, propertyName);
NumericClientModelValidatorTest.cs (5)
19
var
metadata = provider.GetMetadataForProperty(typeof(TypeWithNumericProperty), "Id");
51
var
metadata = provider.GetMetadataForProperty(
86
var
metadata = provider.GetMetadataForParameter(parameter);
112
var
metadata = provider.GetMetadataForType(typeof(int));
134
var
metadata = provider.GetMetadataForProperty(typeof(TypeWithNumericProperty), "Id");
RangeAttributeAdapterTest.cs (3)
20
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
50
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
86
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
RequiredAttributeAdapterTest.cs (3)
21
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
56
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
81
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
StringLengthAttributeAdapterTest.cs (5)
21
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
56
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
83
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
111
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
137
var
metadata = provider.GetMetadataForProperty(typeof(string), "Length");
ValidatableObjectAdapterTest.cs (4)
17
public static TheoryData<
ModelMetadata
, string, string> Validate_PassesExpectedNamesData
23
return new TheoryData<
ModelMetadata
, string, string>
113
ModelMetadata
metadata,
153
var
metadata = _metadataProvider.GetMetadataForProperty(
ValidationAttributeAdapterOfTAttributeTest.cs (1)
20
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(string), "Length");
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (8)
XmlDataContractSerializerInputFormatterTest.cs (4)
76
var
metadata = provider.GetMetadataForType(typeof(string));
514
var
metadata = provider.GetMetadataForType(typeof(TestLevelOne));
578
var
metadata = provider.GetMetadataForType(typeof(TestLevelOne));
725
var
metadata = provider.GetMetadataForType(modelType);
XmlSerializerInputFormatterTest.cs (4)
255
var
metadata = provider.GetMetadataForType(typeof(string));
535
var
metadata = provider.GetMetadataForType(typeof(TestLevelOne));
599
var
metadata = provider.GetMetadataForType(typeof(TestLevelOne));
661
var
metadata = provider.GetMetadataForType(modelType);
Microsoft.AspNetCore.Mvc.IntegrationTests (190)
ActionParametersIntegrationTest.cs (9)
649
var
modelMetadata = modelMetadataProvider
682
var
modelMetadata = modelMetadataProvider
727
var
modelMetadata = modelMetadataProvider
780
var
modelMetadata = modelMetadataProvider
822
var
modelMetadata = modelMetadataProvider
867
var
modelMetadata = modelMetadataProvider
1069
public CustomComplexTypeModelBinder(IDictionary<
ModelMetadata
, IModelBinder> propertyBinders)
1085
var propertyBinders = new Dictionary<
ModelMetadata
, IModelBinder>();
1086
foreach (
var
property in context.Metadata.Properties)
ArrayModelBinderIntegrationTest.cs (1)
394
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
BindPropertyIntegrationTest.cs (4)
121
var
modelMetadata = modelMetadataProvider
161
var
modelMetadata = modelMetadataProvider
219
var
modelMetadata = modelMetadataProvider
280
var
modelMetadata = modelMetadataProvider
CollectionModelBinderIntegrationTest.cs (6)
991
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
1020
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
1077
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
1115
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
1143
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
1192
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
ComplexRecordIntegrationTest.cs (80)
49
var
metadata = GetMetadata(testContext, parameter);
99
var
metadata = GetMetadata(testContext, parameter);
151
var
metadata = GetMetadata(testContext, parameter);
205
var
metadata = GetMetadata(testContext, parameter);
254
var
metadata = GetMetadata(testContext, parameter);
303
var
metadata = GetMetadata(testContext, parameter);
351
var
metadata = GetMetadata(testContext, parameter);
403
var
metadata = GetMetadata(testContext, parameter);
455
var
metadata = GetMetadata(testContext, parameter);
508
var
metadata = GetMetadata(testContext, parameter);
561
var
metadata = GetMetadata(testContext, parameter);
615
var
metadata = GetMetadata(testContext, parameter);
665
var
metadata = GetMetadata(testContext, parameter);
722
var
metadata = GetMetadata(testContext, parameter);
776
var
metadata = GetMetadata(testContext, parameter);
831
var
metadata = GetMetadata(testContext, parameter);
886
var
metadata = GetMetadata(testContext, parameter);
933
var
metadata = GetMetadata(testContext, parameter);
979
var
metadata = GetMetadata(testContext, parameter);
1034
var
metadata = GetMetadata(testContext, parameter);
1089
var
metadata = GetMetadata(testContext, parameter);
1136
var
metadata = GetMetadata(testContext, parameter);
1182
var
metadata = GetMetadata(testContext, parameter);
1237
var
metadata = GetMetadata(testContext, parameter);
1292
var
metadata = GetMetadata(testContext, parameter);
1339
var
metadata = GetMetadata(testContext, parameter);
1398
var
metadata = GetMetadata(testContext, parameter);
1505
var
metadata = GetMetadata(testContext, parameter);
1612
var
metadata = GetMetadata(testContext, parameter);
1716
var
metadata = GetMetadata(testContext, parameter);
1771
var
metadata = GetMetadata(testContext, parameter);
1835
var
metadata = GetMetadata(testContext, parameter);
1921
var
metadata = GetMetadata(testContext, parameter);
1967
var
metadata = GetMetadata(testContext, parameter);
2023
var
metadata = GetMetadata(testContext, parameter);
2075
var
metadata = GetMetadata(testContext, parameter);
2129
var
metadata = GetMetadata(testContext, parameter);
2187
var
metadata = GetMetadata(testContext, parameter);
2243
var
metadata = GetMetadata(testContext, parameter);
2295
var
metadata = GetMetadata(testContext, parameter);
2343
var
metadata = GetMetadata(testContext, parameter);
2391
var
metadata = GetMetadata(testContext, parameter);
2443
var
metadata = GetMetadata(testContext, parameter);
2490
var
metadata = GetMetadata(testContext, parameter);
2540
var
metadata = GetMetadata(testContext, parameter);
2594
var
metadata = GetMetadata(testContext, parameter);
2653
var
metadata = GetMetadata(testContext, parameter);
2702
var
metadata = GetMetadata(testContext, parameter);
2758
var
metadata = GetMetadata(testContext, parameter);
2812
var
metadata = GetMetadata(testContext, parameter);
2870
var
metadata = GetMetadata(testContext, parameter);
2916
var
metadata = GetMetadata(testContext, parameter);
2985
var
metadata = GetMetadata(testContext, parameter);
3057
var
metadata = GetMetadata(testContext, parameter);
3121
var
metadata = GetMetadata(testContext, parameter);
3173
var
metadata = GetMetadata(testContext, parameter);
3248
var
metadata = GetMetadata(testContext, parameter);
3319
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
3348
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
3389
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
3423
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
3455
var
metadata = GetMetadata(testContext, parameter);
3497
var
metadata = GetMetadata(testContext, parameter);
3540
var
metadata = GetMetadata(testContext, parameter);
3583
var
metadata = GetMetadata(testContext, parameter);
3634
var
metadata = GetMetadata(testContext, parameter);
3680
var
metadata = GetMetadata(testContext, parameter);
3732
var
metadata = GetMetadata(testContext, parameter);
3775
var
metadata = GetMetadata(testContext, parameter);
3820
var
metadata = GetMetadata(testContext, parameter);
3863
var
metadata = GetMetadata(testContext, parameter);
3907
var
metadata = GetMetadata(testContext, parameter);
3952
var
metadata = GetMetadata(testContext, parameter);
3996
var
metadata = GetMetadata(testContext, parameter);
4037
var
metadata = GetMetadata(testContext, parameter);
4080
var
metadata = GetMetadata(testContext, parameter);
4125
var
metadata = GetMetadata(testContext, parameter);
4170
var
metadata = GetMetadata(testContext, parameter);
4241
private
ModelMetadata
GetMetadata(ModelBindingTestContext context, ParameterDescriptor parameter)
4249
ModelMetadata
metadata)
ComplexTypeIntegrationTestBase.cs (65)
39
var
metadata = GetMetadata(testContext, parameter);
86
var
metadata = GetMetadata(testContext, parameter);
136
var
metadata = GetMetadata(testContext, parameter);
188
var
metadata = GetMetadata(testContext, parameter);
237
var
metadata = GetMetadata(testContext, parameter);
286
var
metadata = GetMetadata(testContext, parameter);
344
var
metadata = GetMetadata(testContext, parameter);
396
var
metadata = GetMetadata(testContext, parameter);
448
var
metadata = GetMetadata(testContext, parameter);
511
var
metadata = GetMetadata(testContext, parameter);
564
var
metadata = GetMetadata(testContext, parameter);
618
var
metadata = GetMetadata(testContext, parameter);
668
var
metadata = GetMetadata(testContext, parameter);
725
var
metadata = GetMetadata(testContext, parameter);
784
var
metadata = GetMetadata(testContext, parameter);
839
var
metadata = GetMetadata(testContext, parameter);
894
var
metadata = GetMetadata(testContext, parameter);
941
var
metadata = GetMetadata(testContext, parameter);
992
var
metadata = GetMetadata(testContext, parameter);
1047
var
metadata = GetMetadata(testContext, parameter);
1102
var
metadata = GetMetadata(testContext, parameter);
1149
var
metadata = GetMetadata(testContext, parameter);
1200
var
metadata = GetMetadata(testContext, parameter);
1255
var
metadata = GetMetadata(testContext, parameter);
1310
var
metadata = GetMetadata(testContext, parameter);
1357
var
metadata = GetMetadata(testContext, parameter);
1434
var
metadata = GetMetadata(testContext, parameter);
1541
var
metadata = GetMetadata(testContext, parameter);
1648
var
metadata = GetMetadata(testContext, parameter);
1757
var
metadata = GetMetadata(testContext, parameter);
1812
var
metadata = GetMetadata(testContext, parameter);
1867
var
metadata = GetMetadata(testContext, parameter);
1916
var
metadata = GetMetadata(testContext, parameter);
1975
var
metadata = GetMetadata(testContext, parameter);
2068
var
metadata = GetMetadata(testContext, parameter);
2121
var
metadata = GetMetadata(testContext, parameter);
2176
var
metadata = GetMetadata(testContext, parameter);
2237
var
metadata = GetMetadata(testContext, parameter);
2291
var
metadata = GetMetadata(testContext, parameter);
2349
var
metadata = GetMetadata(testContext, parameter);
2409
var
metadata = GetMetadata(testContext, parameter);
2461
var
metadata = GetMetadata(testContext, parameter);
2509
var
metadata = GetMetadata(testContext, parameter);
2561
var
metadata = GetMetadata(testContext, parameter);
2613
var
metadata = GetMetadata(testContext, parameter);
2660
var
metadata = GetMetadata(testContext, parameter);
2713
var
metadata = GetMetadata(testContext, parameter);
2767
var
metadata = GetMetadata(testContext, parameter);
2832
var
metadata = GetMetadata(testContext, parameter);
2881
var
metadata = GetMetadata(testContext, parameter);
2949
var
metadata = GetMetadata(testContext, parameter);
3003
var
metadata = GetMetadata(testContext, parameter);
3063
var
metadata = GetMetadata(testContext, parameter);
3120
var
metadata = GetMetadata(testContext, parameter);
3193
var
metadata = GetMetadata(testContext, parameter);
3272
var
metadata = GetMetadata(testContext, parameter);
3343
var
metadata = GetMetadata(testContext, parameter);
3395
var
metadata = GetMetadata(testContext, parameter);
3477
var
metadata = GetMetadata(testContext, parameter);
3554
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
3593
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
3640
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
3692
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
3740
private
ModelMetadata
GetMetadata(ModelBindingTestContext context, ParameterDescriptor parameter)
3748
ModelMetadata
metadata)
DictionaryModelBinderIntegrationTest.cs (1)
1220
var
metadata = testContext.MetadataProvider.GetMetadataForType(parameter.ParameterType);
NullableReferenceTypeIntegrationTest.cs (1)
169
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
ParameterBinderExtensions.cs (2)
41
ModelMetadata
metadata;
60
ModelMetadata
modelMetadata)
ValidationIntegrationTests.cs (10)
1547
var
otherProperty = parentEntry.Metadata.Properties[_otherProperty];
2025
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
2077
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
2147
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
2313
var
modelMetadata = modelMetadataProvider.GetMetadataForProperty(propertyInfo, propertyInfo.PropertyType);
2367
var
modelMetadata = modelMetadataProvider.GetMetadataForProperty(propertyInfo, propertyInfo.PropertyType);
2471
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
2517
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
2599
public List<
ModelMetadata
> Visited = new();
2601
protected override bool Visit(
ModelMetadata
metadata, string key, object model)
ValidationWithRecordIntegrationTests.cs (11)
1357
var
otherProperty = parentEntry.Metadata.Properties[_otherProperty];
1816
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
1868
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
1938
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
2104
var
modelMetadata = modelMetadataProvider.GetMetadataForProperty(propertyInfo, propertyInfo.PropertyType);
2155
var
modelMetadata = modelMetadataProvider.GetMetadataForProperty(propertyInfo, propertyInfo.PropertyType);
2257
var
modelMetadata = modelMetadataProvider.GetMetadataForParameter(parameterInfo);
2307
var
modelMetadata = modelMetadataProvider.GetMetadataForType(modelType);
2346
var
modelMetadata = modelMetadataProvider.GetMetadataForType(modelType);
2387
var
modelMetadata = modelMetadataProvider.GetMetadataForType(modelType);
2424
var
modelMetadata = modelMetadataProvider.GetMetadataForType(modelType);
Microsoft.AspNetCore.Mvc.NewtonsoftJson (4)
NewtonsoftJsonInputFormatter.cs (4)
307
var
metadata = GetPathMetadata(context.Metadata, path);
364
private static
ModelMetadata
GetPathMetadata(
ModelMetadata
metadata, string path)
400
var
propertyMetadata = metadata.Properties[propertyName];
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (3)
NewtonsoftJsonPatchInputFormatterTest.cs (2)
188
var
metadata = provider.GetMetadataForType(modelType);
244
var
metadata = provider.GetMetadataForType(modelType);
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (1)
655
var
metadata = provider.GetMetadataForType(modelType);
Microsoft.AspNetCore.Mvc.RazorPages (14)
ApplicationModels\DefaultPageApplicationModelPartsProvider.cs (2)
84
var
modelMetadata = modelMetadataProviderBase.GetMetadataForParameter(parameter);
112
var
propertyMetadata = _modelMetadataProvider.GetMetadataForProperty(property.DeclaringType!, property.Name);
Infrastructure\PageBinderFactory.cs (6)
33
var
metadata = modelMetadataProvider.GetMetadataForProperty(handlerType, property.Name);
58
var
modelMetadata = bindingInfo.ModelMetadata;
99
ModelMetadata
metadata;
139
var
modelMetadata = bindingInfo.ModelMetadata;
165
public BinderItem(IModelBinder modelBinder,
ModelMetadata
modelMetadata)
171
public
ModelMetadata
ModelMetadata { get; }
PageBase.cs (3)
1391
Func<
ModelMetadata
, bool> propertyFilter)
1463
Func<
ModelMetadata
, bool> propertyFilter)
1531
Func<
ModelMetadata
, bool> propertyFilter)
PageModel.cs (3)
296
Func<
ModelMetadata
, bool> propertyFilter)
368
Func<
ModelMetadata
, bool> propertyFilter)
436
Func<
ModelMetadata
, bool> propertyFilter)
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Infrastructure\PageBinderFactoryTest.cs (1)
826
ModelMetadata
metadata,
Microsoft.AspNetCore.Mvc.TagHelpers (2)
InputTagHelper.cs (2)
180
var
metadata = For.Metadata;
280
/// <see cref="
ModelMetadata
.ModelType"/> base class, used to determine this method's return value.</param>
Microsoft.AspNetCore.Mvc.TagHelpers.Test (12)
InputTagHelperTest.cs (2)
2400
var
containerMetadata = metadataProvider.GetMetadataForType(containerType);
2403
var
propertyMetadata = metadataProvider.GetMetadataForProperty(containerType, propertyName);
LabelTagHelperTest.cs (2)
168
var
containerMetadata = metadataProvider.GetMetadataForType(containerType);
171
var
propertyMetadata = metadataProvider.GetMetadataForProperty(containerType, "Text");
SelectTagHelperTest.cs (6)
190
var
containerMetadata = metadataProvider.GetMetadataForType(containerType);
193
var
propertyMetadata = metadataProvider.GetMetadataForProperty(containerType, "Text");
280
var
containerMetadata = metadataProvider.GetMetadataForType(containerType);
283
var
propertyMetadata = metadataProvider.GetMetadataForProperty(containerType, "Text");
460
var
containerMetadata = metadataProvider.GetMetadataForType(containerType);
463
var
propertyMetadata = metadataProvider.GetMetadataForProperty(containerType, "Text");
TextAreaTagHelperTest.cs (2)
99
var
containerMetadata = metadataProvider.GetMetadataForType(containerType);
102
var
propertyMetadata = metadataProvider.GetMetadataForProperty(containerType, "Text");
Microsoft.AspNetCore.Mvc.ViewFeatures (99)
DefaultDisplayTemplates.cs (3)
88
var
elementMetadata = htmlHelper.ViewData.ModelMetadata.ElementMetadata;
114
var
itemMetadata = elementMetadata;
215
var
propertyMetadata = propertyExplorer.Metadata;
DefaultEditorTemplates.cs (4)
70
var
elementMetadata = htmlHelper.ViewData.ModelMetadata.ElementMetadata;
96
var
itemMetadata = elementMetadata;
257
var
propertyMetadata = propertyExplorer.Metadata;
421
var
metadata = htmlHelper.ViewData.ModelMetadata;
DefaultHtmlGenerator.cs (1)
956
var
metadata = modelExplorer.Metadata;
ExpressionMetadataProvider.cs (5)
95
ModelMetadata
metadata = null;
176
var
containerMetadata = metadataProvider.GetMetadataForType(viewDataInfo.Container.GetType());
177
var
propertyMetadata = containerMetadata.Properties[viewDataInfo.PropertyInfo.Name];
185
var
valueMetadata = metadataProvider.GetMetadataForType(viewDataInfo.Value.GetType());
191
var
stringMetadata = metadataProvider.GetMetadataForType(typeof(string));
HtmlHelper.cs (5)
369
var
metadata = MetadataProvider.GetMetadataForType(type);
387
var
metadata = MetadataProvider.GetMetadataForType(enumType);
1359
/// <param name="metadata"><see cref="
ModelMetadata
"/> to generate a select list for.</param>
1365
/// Thrown if <paramref name="metadata"/>'s <see cref="
ModelMetadata
.ModelType"/> is not an <see cref="Enum"/>
1368
protected virtual IEnumerable<SelectListItem> GetEnumSelectList(
ModelMetadata
metadata)
ModelExplorer.cs (28)
11
/// Associates a model object with it's corresponding <see cref="
ModelMetadata
"/>.
26
/// <param name="metadata">The <see cref="
ModelMetadata
"/>.</param>
30
ModelMetadata
metadata,
46
/// <param name="metadata">The <see cref="
ModelMetadata
"/>.</param>
51
ModelMetadata
metadata,
69
/// <param name="metadata">The <see cref="
ModelMetadata
"/>.</param>
74
ModelMetadata
metadata,
104
/// instances, then use <see cref="
ModelMetadata
.ContainerType"/> to validate this assumption.
110
/// Gets the <see cref="
ModelMetadata
"/>.
112
public
ModelMetadata
Metadata { get; }
170
/// Includes a <see cref="ModelExplorer"/> for each property of the <see cref="
ModelMetadata
"/>
181
var
metadata = GetMetadataForRuntimeType();
188
var
propertyMetadata = properties[i];
264
var
metadata = GetMetadataForRuntimeType();
266
var
propertyMetadata = metadata.Properties[name];
289
var
metadata = GetMetadataForRuntimeType();
291
var
propertyMetadata = metadata.Properties[name];
320
var
metadata = _metadataProvider.GetMetadataForType(modelType);
327
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with the model.</param>
333
/// <see cref="GetExplorerForExpression(
ModelMetadata
, object)"/>
341
public ModelExplorer GetExplorerForExpression(
ModelMetadata
metadata, object model)
369
var
metadata = _metadataProvider.GetMetadataForType(modelType);
376
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with the model.</param>
382
/// <see cref="GetExplorerForExpression(
ModelMetadata
, Func{object, object})"/>
390
public ModelExplorer GetExplorerForExpression(
ModelMetadata
metadata, Func<object, object> modelAccessor)
397
private
ModelMetadata
GetMetadataForRuntimeType()
401
var
metadata = Metadata;
411
ModelMetadata
propertyMetadata,
ModelExpression.cs (1)
39
public
ModelMetadata
Metadata => ModelExplorer.Metadata;
ModelMetadataProviderExtensions.cs (1)
31
var
modelMetadata = provider.GetMetadataForType(modelType);
ModelStateDictionaryExtensions.cs (5)
45
/// when <see cref="
ModelMetadata
"/> is not available or the exact <paramref name="exception"/>
73
/// <param name="metadata">The <see cref="
ModelMetadata
"/> associated with the model.</param>
78
ModelMetadata
metadata)
124
var
modelMetadata = new EmptyModelMetadataProvider().GetMetadataForType(typeof(TModel));
127
var
property = modelMetadata.Properties[i];
Rendering\HtmlHelperDisplayExtensions.cs (16)
16
/// using the <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
48
/// <see cref="ModelBinding.
ModelMetadata
"/>.
92
/// <see cref="ModelBinding.
ModelMetadata
"/>.
128
/// <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
174
/// <paramref name="expression"/>'s<see cref="ModelBinding.
ModelMetadata
"/>.
214
/// using the <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
248
/// <see cref="ModelBinding.
ModelMetadata
"/>.
288
/// <see cref="ModelBinding.
ModelMetadata
"/>.
324
/// <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
366
/// <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
406
/// model's <see cref="ModelBinding.
ModelMetadata
"/>.
433
/// template is found using the model's <see cref="ModelBinding.
ModelMetadata
"/>.
465
/// <paramref name="templateName"/> or the model's <see cref="ModelBinding.
ModelMetadata
"/>.
494
/// <see cref="ModelBinding.
ModelMetadata
"/>.
531
/// <see cref="ModelBinding.
ModelMetadata
"/>.
567
/// <see cref="ModelBinding.
ModelMetadata
"/>.
Rendering\HtmlHelperEditorExtensions.cs (16)
16
/// using the <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
48
/// <see cref="ModelBinding.
ModelMetadata
"/>.
92
/// <see cref="ModelBinding.
ModelMetadata
"/>.
125
/// <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
171
/// <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
211
/// using the <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
241
/// <see cref="ModelBinding.
ModelMetadata
"/>.
281
/// <see cref="ModelBinding.
ModelMetadata
"/>.
313
/// <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
355
/// <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
391
/// model's <see cref="ModelBinding.
ModelMetadata
"/>.
418
/// template is found using the model's <see cref="ModelBinding.
ModelMetadata
"/>.
450
/// <paramref name="templateName"/> or the model's <see cref="ModelBinding.
ModelMetadata
"/>.
479
/// <see cref="ModelBinding.
ModelMetadata
"/>.
516
/// <see cref="ModelBinding.
ModelMetadata
"/>.
552
/// <see cref="ModelBinding.
ModelMetadata
"/>.
Rendering\IHtmlHelper.cs (3)
197
/// <paramref name="expression"/>'s <see cref="
ModelMetadata
"/>.
247
/// If the expression result is <c>null</c>, returns <see cref="
ModelMetadata
.NullDisplayText"/>.
289
/// <paramref name="expression"/>'s <see cref="
ModelMetadata
"/>.
Rendering\IHtmlHelperOfT.cs (3)
49
/// <paramref name="expression"/>’s <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.
ModelMetadata
.TemplateHint"/>.
109
/// <see cref="ModelBinding.
ModelMetadata
.NullDisplayText"/>.
151
/// <paramref name="expression"/>'s <see cref="ModelBinding.
ModelMetadata
"/>.
TemplateBuilder.cs (1)
22
private readonly
ModelMetadata
_metadata;
TemplateRenderer.cs (2)
147
var
metadata = _viewData.ModelMetadata;
169
public static IEnumerable<string> GetTypeNames(
ModelMetadata
modelMetadata, Type fieldType)
ValidationHelpers.cs (3)
59
var
metadata = viewData.ModelMetadata;
84
ModelMetadata
metadata,
98
var
propertyMetadata = metadata.Properties[i];
ViewDataDictionary.cs (2)
278
/// Gets the <see cref="ModelBinding.
ModelMetadata
"/> for an expression, the <see cref="Model"/> (if
285
public
ModelMetadata
ModelMetadata
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (35)
DefaultHtmlGeneratorTest.cs (9)
199
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression);
223
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression);
247
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression);
269
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), nameof(ModelWithMaxLengthMetadata.FieldWithBothAttributes));
291
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), nameof(ModelWithMaxLengthMetadata.FieldWithoutAttributes));
314
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression);
367
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(Model), expression);
397
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(Model), expression);
422
var
modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression);
ModelStateDictionaryExtensionsTest.cs (4)
102
var
metadata = provider.GetMetadataForProperty(typeof(TestModel), nameof(TestModel.Text));
140
var
metadata = provider.GetMetadataForProperty(typeof(ChildModel), nameof(ChildModel.Text));
178
var
metadata = provider.GetMetadataForProperty(typeof(ChildModel), nameof(ChildModel.Value));
218
var
metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
PageRemoteAttributeTest.cs (1)
172
var
metadata = metadataProvider.GetMetadataForProperty(
RemoteAttributeBaseTest.cs (1)
494
var
metadata = metadataProvider.GetMetadataForProperty(
RemoteAttributeTest.cs (2)
375
var
metadata = metadataProvider.GetMetadataForProperty(
422
var
metadata = metadataProvider.GetMetadataForProperty(
Rendering\DefaultTemplatesUtilities.cs (1)
336
var
metadata = modelExplorer.Metadata;
Rendering\HtmlHelperNameExtensionsTest.cs (2)
163
var metadata = new Mock<
ModelMetadata
>(
192
var metadata = new Mock<
ModelMetadata
>(
Rendering\HtmlHelperSelectTest.cs (6)
1313
var
metadata = metadataProvider.GetMetadataForType(typeof(EnumWithFields));
1329
var
metadata = metadataProvider.GetMetadataForType(typeof(EnumWithFields));
1389
var
metadata = metadataProvider.GetMetadataForType(typeof(EnumWithFields));
1494
var
metadata = metadataProvider.GetMetadataForType(type);
1583
public
ModelMetadata
Metadata { get; private set; }
1589
protected override IEnumerable<SelectListItem> GetEnumSelectList(
ModelMetadata
metadata)
Rendering\HtmlHelperValidationSummaryTest.cs (2)
671
var
metadata = provider.GetMetadataForProperty(typeof(ValidationModel), nameof(ValidationModel.Property3));
690
var
metadata = provider.GetMetadataForProperty(typeof(OrderedModel), nameof(OrderedModel.Property3));
TemplateRendererTest.cs (1)
50
var
metadata = metadataProvider.GetMetadataForType(fieldType);
ViewDataDictionaryTest.cs (6)
283
var
sourceMetadata = source.ModelMetadata;
327
var
originalMetadata = viewData.ModelMetadata;
349
var
metadata = metadataProvider.GetMetadataForType(originalMetadataType);
374
var
metadata = metadataProvider.GetMetadataForType(typeof(bool?));
419
var
originalMetadata = viewData.ModelMetadata;
446
var
originalMetadata = viewData.ModelMetadata;