1 type derived from BindingSource
Microsoft.AspNetCore.Mvc.Abstractions (1)
ModelBinding\CompositeBindingSource.cs (1)
12
public class CompositeBindingSource :
BindingSource
24 instantiations of BindingSource
Microsoft.AspNetCore.Mvc.Abstractions (10)
ModelBinding\BindingSource.cs (10)
19
public static readonly BindingSource Body = new
BindingSource
(
28
public static readonly BindingSource Custom = new
BindingSource
(
37
public static readonly BindingSource Form = new
BindingSource
(
46
public static readonly BindingSource Header = new
BindingSource
(
56
public static readonly BindingSource ModelBinding = new
BindingSource
(
65
public static readonly BindingSource Path = new
BindingSource
(
74
public static readonly BindingSource Query = new
BindingSource
(
83
public static readonly BindingSource Services = new
BindingSource
(
92
public static readonly BindingSource Special = new
BindingSource
(
101
public static readonly BindingSource FormFile = new
BindingSource
(
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (2)
DefaultApiDescriptionProviderTest.cs (2)
331
var expected = new
BindingSource
(source, displayName: null, isGreedy: false, isFromRequest: false);
362
var expected = new
BindingSource
(source, displayName: null, isGreedy: false, isFromRequest: false);
Microsoft.AspNetCore.Mvc.Core.Test (11)
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (1)
1352
get { return new
BindingSource
("Special", string.Empty, isGreedy: true, isFromRequest: true); }
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (1)
1527
get { return new
BindingSource
("Special", string.Empty, isGreedy: true, isFromRequest: true); }
ModelBinding\BindingSourceValueProviderTest.cs (1)
18
var bindingSource = new
BindingSource
(
ModelBinding\CompositeValueProviderTest.cs (3)
21
var bindingSource = new
BindingSource
(
264
return new
BindingSource
("Test", displayName: null, isGreedy: true, isFromRequest: true);
279
return new
BindingSource
("Unrelated", displayName: null, isGreedy: true, isFromRequest: true);
ModelBinding\EnumerableValueProviderTest.cs (2)
257
var bindingSource = new
BindingSource
(
277
var bindingSource = new
BindingSource
(
ModelBinding\RouteValueProviderTests.cs (2)
237
var bindingSource = new
BindingSource
(
258
var bindingSource = new
BindingSource
(
ModelBinding\TestValueProvider.cs (1)
10
public static readonly BindingSource TestBindingSource = new
BindingSource
(
Microsoft.AspNetCore.Mvc.IntegrationTests (1)
GenericModelBinderIntegrationTest.cs (1)
133
public static readonly BindingSource Source = new
BindingSource
(
699 references to BindingSource
ApplicationModelWebSite (1)
Controllers\ParameterModelController.cs (1)
26
model.BindingInfo.BindingSource =
BindingSource
.Custom;
FormatterWebSite (2)
ValidateBodyParameterAttribute.cs (2)
44
private bool IsBodyBindingSource(
BindingSource
bindingSource)
46
return bindingSource?.CanAcceptDataFrom(
BindingSource
.Body) ?? false;
Microsoft.AspNetCore.Grpc.Swagger (4)
Internal\GrpcJsonTranscodingDescriptionProvider.cs (3)
119
Source =
BindingSource
.Path,
141
Source =
BindingSource
.Body,
161
Source =
BindingSource
.Query,
Internal\GrpcModelMetadata.cs (1)
21
public override
BindingSource
BindingSource { get; }
Microsoft.AspNetCore.Mvc.Abstractions (52)
ApiExplorer\ApiParameterDescription.cs (3)
30
/// Gets or sets the <see cref="
BindingSource
"/>.
32
public
BindingSource
Source { get; set; } = default!;
55
/// <item><description>it's bound from the request body (<see cref="
BindingSource
.Body"/>).</description></item>
ApiExplorer\ApiParameterRouteInfo.cs (1)
34
/// If the parameter uses <see cref="ModelBinding.
BindingSource
.ModelBinding"/> for the value of
ModelBinding\BindingInfo.cs (4)
43
/// Gets or sets the <see cref="ModelBinding.
BindingSource
"/>.
45
public
BindingSource
? BindingSource { get; set; }
188
bindingInfo.BindingSource =
BindingSource
.Services;
261
BindingSource ==
BindingSource
.Body &&
ModelBinding\BindingSource.cs (32)
14
public class BindingSource : IEquatable<
BindingSource
?>
17
/// A <see cref="
BindingSource
"/> for the request body.
19
public static readonly
BindingSource
Body = new BindingSource(
26
/// A <see cref="
BindingSource
"/> for a custom model binder (unknown data source).
28
public static readonly
BindingSource
Custom = new BindingSource(
35
/// A <see cref="
BindingSource
"/> for the request form-data.
37
public static readonly
BindingSource
Form = new BindingSource(
44
/// A <see cref="
BindingSource
"/> for the request headers.
46
public static readonly
BindingSource
Header = new BindingSource(
53
/// A <see cref="
BindingSource
"/> for model binding. Includes form-data, query-string
56
public static readonly
BindingSource
ModelBinding = new BindingSource(
63
/// A <see cref="
BindingSource
"/> for the request url path.
65
public static readonly
BindingSource
Path = new BindingSource(
72
/// A <see cref="
BindingSource
"/> for the request query-string.
74
public static readonly
BindingSource
Query = new BindingSource(
81
/// A <see cref="
BindingSource
"/> for request services.
83
public static readonly
BindingSource
Services = new BindingSource(
90
/// A <see cref="
BindingSource
"/> for special parameter types that are not user input.
92
public static readonly
BindingSource
Special = new BindingSource(
99
/// A <see cref="
BindingSource
"/> for <see cref="IFormFile"/>, <see cref="IFormCollection"/>, and <see cref="IFormFileCollection"/>.
101
public static readonly
BindingSource
FormFile = new BindingSource(
108
/// Creates a new <see cref="
BindingSource
"/>.
161
/// Some sources (like <see cref="
BindingSource
.Services"/>) are based on application state and not user
167
/// Gets a value indicating whether or not the <see cref="
BindingSource
"/> can accept
170
/// <param name="bindingSource">The <see cref="
BindingSource
"/> to consider as input.</param>
180
public virtual bool CanAcceptDataFrom(
BindingSource
bindingSource)
206
public bool Equals(
BindingSource
? other)
214
return Equals(obj as
BindingSource
);
224
public static bool operator ==(
BindingSource
? s1,
BindingSource
? s2)
235
public static bool operator !=(
BindingSource
? s1,
BindingSource
? s2)
ModelBinding\CompositeBindingSource.cs (8)
18
/// The set of <see cref="
BindingSource
"/> entries.
24
IEnumerable<
BindingSource
> bindingSources,
29
foreach (
var
bindingSource in bindingSources)
63
IEnumerable<
BindingSource
> bindingSources)
73
/// Gets the set of <see cref="
BindingSource
"/> entries.
75
public IEnumerable<
BindingSource
> BindingSources { get; }
78
public override bool CanAcceptDataFrom(
BindingSource
bindingSource)
90
foreach (
var
source in BindingSources)
ModelBinding\IBindingSourceMetadata.cs (1)
18
BindingSource
? BindingSource { get; }
ModelBinding\ModelBindingContext.cs (2)
28
/// Gets or sets a value which represents the <see cref="ModelBinding.
BindingSource
"/> associated with the
31
public abstract
BindingSource
? BindingSource { get; set; }
ModelBinding\ModelMetadata.cs (1)
214
public abstract
BindingSource
? BindingSource { get; }
Microsoft.AspNetCore.Mvc.Abstractions.Test (8)
ModelBinding\BindingInfoTest.cs (7)
27
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
108
metadata.BindingSource =
BindingSource
.Special;
157
metadata.BindingSource =
BindingSource
.Special;
170
Assert.Same(
BindingSource
.Custom, bindingInfo.BindingSource);
208
metadata.BindingSource =
BindingSource
.Services;
217
Assert.Same(
BindingSource
.Services, bindingInfo.BindingSource);
309
Assert.Same(
BindingSource
.Services, bindingInfo.BindingSource);
ModelBinding\ModelMetadataTest.cs (1)
487
public override
BindingSource
BindingSource
Microsoft.AspNetCore.Mvc.ApiExplorer (37)
DefaultApiDescriptionProvider.cs (20)
135
if (parameter.Source ==
BindingSource
.Body)
145
else if (parameter.Source ==
BindingSource
.FormFile)
250
if (parameter.Source ==
BindingSource
.Path ||
251
parameter.Source ==
BindingSource
.ModelBinding ||
252
parameter.Source ==
BindingSource
.Custom)
259
if (parameter.Source ==
BindingSource
.ModelBinding &&
264
parameter.Source =
BindingSource
.Path;
269
if (parameter.Source ==
BindingSource
.Path &&
292
Source =
BindingSource
.Path,
301
if (parameter.Source ==
BindingSource
.Body)
318
if (parameter.Source ==
BindingSource
.Path && parameter.RouteInfo != null && !parameter.RouteInfo.IsOptional)
329
if (parameter.Source ==
BindingSource
.Path)
518
public
BindingSource
? BindingSource { get; }
562
var
source =
BindingSource
.ModelBinding;
568
BindingSource
ambientSource,
571
var
source = bindingContext.BindingSource;
655
BindingSource
source,
692
public readonly
BindingSource
? Source;
694
public PropertyKey(ModelMetadata metadata,
BindingSource
? source)
EndpointMetadataApiDescriptionProvider.cs (16)
127
parameterDescription.Source ==
BindingSource
.Body ||
128
parameterDescription.Source ==
BindingSource
.FormFile;
147
Source =
BindingSource
.Body,
177
if (source ==
BindingSource
.Services)
250
private (
BindingSource
, string, bool, Type) GetBindingSourceAndName(IParameterBindingMetadata parameter, RouteEndpoint routeEndpoint, bool disableInferredBody)
259
return (
BindingSource
.Path, routeAttribute.Name ?? name, false, parameterType);
263
return (
BindingSource
.Query, queryAttribute.Name ?? parameter.Name ?? string.Empty, false, parameterType);
267
return (
BindingSource
.Header, headerAttribute.Name ?? parameter.Name ?? string.Empty, false, parameterType);
271
return (
BindingSource
.Body, parameter.Name ?? string.Empty, fromBodyAttribute.AllowEmpty, parameterType);
275
return (
BindingSource
.FormFile, fromFormAttribute.Name ?? parameter.Name ?? string.Empty, false, parameterType);
286
return (
BindingSource
.Services, parameter.Name ?? string.Empty, false, parameterType);
296
return (
BindingSource
.Path, routeParam.Name, false, displayType);
300
return (
BindingSource
.Query, parameter.Name ?? string.Empty, false, displayType);
305
return (
BindingSource
.FormFile, parameter.Name ?? string.Empty, false, parameterType);
312
return (
BindingSource
.Query, parameter.Name ?? string.Empty, false, parameterType);
316
return (
BindingSource
.Body, parameter.Name ?? string.Empty, false, parameterType);
EndpointModelMetadata.cs (1)
21
public override
BindingSource
? BindingSource { get; }
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (101)
DefaultApiDescriptionProviderTest.cs (76)
185
Assert.Equal(
BindingSource
.Path, parameter.Source);
231
Assert.Equal(
BindingSource
.Path, parameter.Source);
259
BindingSource =
BindingSource
.Path
288
BindingSource =
BindingSource
.Path
297
Assert.Equal(
BindingSource
.Path, parameter.Source);
331
var
expected = new BindingSource(source, displayName: null, isGreedy: false, isFromRequest: false);
362
var
expected = new BindingSource(source, displayName: null, isGreedy: false, isFromRequest: false);
438
Assert.Equal(
BindingSource
.Path, id1.Source);
442
Assert.Equal(
BindingSource
.Path, id2.Source);
1327
Assert.Same(
BindingSource
.ModelBinding, parameter.Source);
1331
Assert.Same(
BindingSource
.ModelBinding, parameter.Source);
1335
Assert.Same(
BindingSource
.ModelBinding, parameter.Source);
1352
Assert.Same(
BindingSource
.ModelBinding, parameter.Source);
1372
Assert.Same(
BindingSource
.Path, parameter.Source);
1389
Assert.Same(
BindingSource
.Query, parameter.Source);
1406
Assert.Same(
BindingSource
.Body, parameter.Source);
1425
Assert.Same(
BindingSource
.Form, parameter.Source);
1429
Assert.Same(
BindingSource
.Form, parameter.Source);
1433
Assert.Same(
BindingSource
.Form, parameter.Source);
1455
Assert.Same(
BindingSource
.FormFile, parameter.Source);
1476
Assert.Same(
BindingSource
.Header, parameter.Source);
1508
Assert.Same(
BindingSource
.Custom, parameter.Source);
1527
Assert.Same(
BindingSource
.ModelBinding, parameter.Source);
1531
Assert.Same(
BindingSource
.ModelBinding, parameter.Source);
1535
Assert.Same(
BindingSource
.ModelBinding, parameter.Source);
1554
Assert.Same(
BindingSource
.Path, id.Source);
1558
Assert.Same(
BindingSource
.Body, product.Source);
1562
Assert.Same(
BindingSource
.Header, userId.Source);
1566
Assert.Same(
BindingSource
.ModelBinding, comments.Source);
1585
Assert.Same(
BindingSource
.Query, id.Source);
1604
Assert.Same(
BindingSource
.Query, id.Source);
1623
Assert.Same(
BindingSource
.Query, id.Source);
1642
Assert.Same(
BindingSource
.Query, id.Source);
1661
Assert.Same(
BindingSource
.Query, id.Source);
1680
Assert.Same(
BindingSource
.Query, id.Source);
1699
Assert.Same(
BindingSource
.Query, id.Source);
1718
Assert.Same(
BindingSource
.Query, id.Source);
1722
Assert.Same(
BindingSource
.Query, product.Source);
1742
Assert.Same(
BindingSource
.Path, id.Source);
1746
Assert.Same(
BindingSource
.Body, product.Source);
1750
Assert.Same(
BindingSource
.Header, userId.Source);
1754
Assert.Same(
BindingSource
.Query, comments.Source);
1773
Assert.Same(
BindingSource
.Path, id.Source);
1777
Assert.Same(
BindingSource
.ModelBinding, quantity.Source);
1781
Assert.Same(
BindingSource
.ModelBinding, productId.Source);
1785
Assert.Same(
BindingSource
.Query, price.Source);
1805
Assert.Same(
BindingSource
.Path, id.Source);
1809
Assert.Same(
BindingSource
.Query, quantity.Source);
1813
Assert.Same(
BindingSource
.Query, productId.Source);
1817
Assert.Same(
BindingSource
.Query, productPrice.Source);
1840
Assert.Same(
BindingSource
.Query, id.Source);
1844
Assert.Same(
BindingSource
.Query, name.Source);
1871
Assert.Same(
BindingSource
.Query, id.Source);
1875
Assert.Same(
BindingSource
.Query, name.Source);
1894
Assert.Same(
BindingSource
.Query, c.Source);
1912
Assert.Same(
BindingSource
.Query, products.Source);
1931
Assert.Same(
BindingSource
.ModelBinding, items.Source);
1953
Assert.Same(
BindingSource
.Query, id.Source);
1957
Assert.Same(
BindingSource
.Query, name.Source);
1975
Assert.Same(
BindingSource
.Header, name.Source);
1979
Assert.Same(
BindingSource
.Form, id.Source);
1998
Assert.Same(
BindingSource
.Query, name.Source);
2002
Assert.Same(
BindingSource
.Path, id.Source);
2006
Assert.Same(
BindingSource
.Body, product.Source);
2010
Assert.Same(
BindingSource
.Header, userId.Source);
2014
Assert.Same(
BindingSource
.ModelBinding, comments.Source);
2022
var description = new ApiParameterDescription { Source =
BindingSource
.Body, };
2036
var description = new ApiParameterDescription { Source =
BindingSource
.Body, };
2052
Source =
BindingSource
.Body,
2073
Source =
BindingSource
.Query,
2095
Source =
BindingSource
.Path,
2150
Source =
BindingSource
.Path,
2174
Source =
BindingSource
.Query,
2197
Source =
BindingSource
.Query,
2897
public
BindingSource
BindingSource =>
BindingSource
.FormFile;
EndpointMetadataApiDescriptionProviderTest.cs (25)
424
Assert.Equal(
BindingSource
.Path, param.Source);
439
Assert.Equal(
BindingSource
.Path, param.Source);
453
Assert.Equal(
BindingSource
.Path, param.Source);
467
Assert.Equal(
BindingSource
.Path, param.Source);
488
Assert.Equal(
BindingSource
.Path, param.Source);
509
Assert.Equal(
BindingSource
.Path, param.Source);
523
Assert.Equal(
BindingSource
.Path, param.Source);
537
Assert.Equal(
BindingSource
.Query, param.Source);
559
Assert.Equal(
BindingSource
.Body, param.Source);
575
Assert.Equal(
BindingSource
.Header, param.Source);
601
Assert.Equal(
BindingSource
.Body, param.Source);
627
Assert.Equal(
BindingSource
.Path, fooParam.Source);
634
Assert.Equal(
BindingSource
.Query, barParam.Source);
641
Assert.Equal(
BindingSource
.Body, fromBodyParam.Source);
657
Assert.Equal(
BindingSource
.Path, param.Source);
664
Assert.Equal(
BindingSource
.Query, param.Source);
672
Assert.Equal(
BindingSource
.Body, param.Source);
748
Assert.Equal(
BindingSource
.Path, fooParam.Source);
754
Assert.Equal(
BindingSource
.Query, barParam.Source);
793
Assert.Equal(
BindingSource
.Query, fooParam.Source);
799
Assert.Equal(
BindingSource
.Query, barParam.Source);
812
Assert.Equal(
BindingSource
.Query, nameParam.Source);
1297
Assert.Equal(
BindingSource
.FormFile, fromFileParam0.Source);
1303
Assert.Equal(
BindingSource
.FormFile, fromFileParam1.Source);
1315
Assert.Equal(
BindingSource
.FormFile, param.Source);
Microsoft.AspNetCore.Mvc.Core (102)
ApiBehaviorOptions.cs (3)
41
/// Parameters that appear as route values, are assumed to be bound from the path (<see cref="
BindingSource
.Path"/>).
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\ConsumesConstraintForFormFileParameterConvention.cs (3)
12
/// to controllers containing form file (<see cref="
BindingSource
.FormFile"/>) parameters.
50
var
bindingSource = parameter.BindingInfo?.BindingSource;
51
if (bindingSource ==
BindingSource
.FormFile)
ApplicationModels\InferParameterBindingInfoConvention.cs (12)
17
/// The goal of this convention is to make intuitive and easy to document <see cref="
BindingSource
"/> inferences. The rules are:
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>
22
/// <item>Parameter with a name that appears as a route value in ANY route template is assigned <see cref="
BindingSource
.Path"/>.</item>
23
/// <item>All other parameters are <see cref="
BindingSource
.Query"/>.</item>
84
var
bindingSource = parameter.BindingInfo?.BindingSource;
92
var fromBodyParameters = action.Parameters.Where(p => p.BindingInfo!.BindingSource ==
BindingSource
.Body).ToList();
114
internal
BindingSource
? InferBindingSourceForParameter(ParameterModel parameter)
120
return
BindingSource
.Services;
123
return metadata.BoundProperties.Any(prop => prop.BindingSource is not null) ? null :
BindingSource
.Body;
128
return
BindingSource
.Path;
131
return
BindingSource
.Query;
BindPropertyAttribute.cs (5)
25
private
BindingSource
? _bindingSource;
38
/// Subclass this attribute and set <see cref="BindingSource"/> if <see cref="
BindingSource
.Custom"/> is not
62
/// defaults to <see cref="
BindingSource
.Custom"/>. May be overridden in a subclass.
64
public virtual
BindingSource
? BindingSource
70
return
BindingSource
.Custom;
FromBodyAttribute.cs (2)
44
public
BindingSource
BindingSource =>
BindingSource
.Body;
FromFormAttribute.cs (2)
32
public
BindingSource
BindingSource =>
BindingSource
.Form;
FromHeaderAttribute.cs (2)
31
public
BindingSource
BindingSource =>
BindingSource
.Header;
FromQueryAttribute.cs (2)
31
public
BindingSource
BindingSource =>
BindingSource
.Query;
FromRouteAttribute.cs (2)
31
public
BindingSource
BindingSource =>
BindingSource
.Path;
FromServicesAttribute.cs (2)
29
public
BindingSource
BindingSource =>
BindingSource
.Services;
Infrastructure\MvcCoreMvcOptionsSetup.cs (5)
116
modelMetadataDetailsProviders.Add(new BindingSourceMetadataProvider(typeof(CancellationToken),
BindingSource
.Special));
117
modelMetadataDetailsProviders.Add(new BindingSourceMetadataProvider(typeof(IFormFile),
BindingSource
.FormFile));
118
modelMetadataDetailsProviders.Add(new BindingSourceMetadataProvider(typeof(IFormCollection),
BindingSource
.FormFile));
119
modelMetadataDetailsProviders.Add(new BindingSourceMetadataProvider(typeof(IFormFileCollection),
BindingSource
.FormFile));
120
modelMetadataDetailsProviders.Add(new BindingSourceMetadataProvider(typeof(IEnumerable<IFormFile>),
BindingSource
.FormFile));
ModelBinderAttribute.cs (6)
29
private
BindingSource
? _bindingSource;
44
/// Subclass this attribute and set <see cref="BindingSource"/> if <see cref="
BindingSource
.Custom"/> is not
56
/// Subclass this attribute and set <see cref="BindingSource"/> if <see cref="
BindingSource
.Custom"/> is not
80
/// defaults to <see cref="
BindingSource
.Custom"/>. May be overridden in a subclass.
82
public virtual
BindingSource
? BindingSource
88
return
BindingSource
.Custom;
ModelBinderOfTAttribute.cs (2)
20
/// Subclass this attribute and set <see cref="
BindingSource
"/> if <see cref="
BindingSource
.Custom"/> is not
ModelBinding\Binders\BodyModelBinder.cs (1)
18
/// when a model has the binding source <see cref="
BindingSource
.Body"/>.
ModelBinding\Binders\BodyModelBinderProvider.cs (1)
73
context.BindingInfo.BindingSource.CanAcceptDataFrom(
BindingSource
.Body))
ModelBinding\Binders\ComplexObjectModelBinder.cs (3)
523
var
bindingSource = bindingContext.BindingSource;
587
var
bindingSource = propertyMetadata.BindingSource;
623
var
bindingSource = parameterMetadata.BindingSource;
ModelBinding\Binders\ComplexTypeModelBinder.cs (2)
328
var
bindingSource = bindingContext.BindingSource;
388
var
bindingSource = propertyMetadata.BindingSource;
ModelBinding\Binders\HeaderModelBinder.cs (1)
15
/// has the binding source <see cref="
BindingSource
.Header"/>.
ModelBinding\Binders\HeaderModelBinderProvider.cs (2)
23
!bindingInfo.BindingSource.CanAcceptDataFrom(
BindingSource
.Header))
43
BindingSource =
BindingSource
.ModelBinding
ModelBinding\Binders\ServicesModelBinder.cs (1)
13
/// has the binding source <see cref="
BindingSource
.Services"/>.
ModelBinding\Binders\ServicesModelBinderProvider.cs (1)
24
context.BindingInfo.BindingSource.CanAcceptDataFrom(
BindingSource
.Services))
ModelBinding\BindingSourceValueProvider.cs (9)
17
/// <see cref="ModelBinding.
BindingSource
"/>.
22
/// <see cref="ModelBinding.
BindingSource
"/>. Value providers are by-default included; if a model does not
23
/// specify a <see cref="ModelBinding.
BindingSource
"/> then all value providers are valid.
32
/// The <see cref="ModelBinding.
BindingSource
"/>. Must be a single-source (non-composite) with
33
/// <see cref="ModelBinding.
BindingSource
.IsGreedy"/> equal to <c>false</c>.
35
public BindingSourceValueProvider(
BindingSource
bindingSource)
59
/// Gets the corresponding <see cref="ModelBinding.
BindingSource
"/>.
61
protected
BindingSource
BindingSource { get; }
70
public virtual IValueProvider? Filter(
BindingSource
bindingSource)
ModelBinding\CompositeValueProvider.cs (1)
161
public IValueProvider? Filter(
BindingSource
bindingSource)
ModelBinding\DefaultModelBindingContext.cs (4)
99
public override
BindingSource
? BindingSource
210
var
bindingSource = bindingInfo?.BindingSource ?? metadata.BindingSource;
308
private static IValueProvider FilterValueProvider(IValueProvider valueProvider,
BindingSource
? bindingSource)
334
public
BindingSource
? BindingSource;
ModelBinding\FormValueProvider.cs (2)
23
/// <param name="bindingSource">The <see cref="
BindingSource
"/> for the data.</param>
27
BindingSource
bindingSource,
ModelBinding\FormValueProviderFactory.cs (1)
55
BindingSource
.Form,
ModelBinding\IBindingSourceValueProvider.cs (4)
9
/// A value provider which can filter its contents based on <see cref="
BindingSource
"/>.
12
/// Value providers are by-default included. If a model does not specify a <see cref="
BindingSource
"/>
20
/// <param name="bindingSource">The <see cref="
BindingSource
"/> associated with a model.</param>
25
IValueProvider? Filter(
BindingSource
bindingSource);
ModelBinding\JQueryFormValueProvider.cs (2)
21
/// <param name="bindingSource">The <see cref="
BindingSource
"/> of the data.</param>
25
BindingSource
bindingSource,
ModelBinding\JQueryFormValueProviderFactory.cs (1)
55
BindingSource
.Form,
ModelBinding\JQueryQueryStringValueProvider.cs (2)
19
/// <param name="bindingSource">The <see cref="
BindingSource
"/> of the data.</param>
23
BindingSource
bindingSource,
ModelBinding\JQueryQueryStringValueProviderFactory.cs (1)
24
BindingSource
.Query,
ModelBinding\JQueryValueProvider.cs (2)
25
/// <param name="bindingSource">The <see cref="
BindingSource
"/> of the data.</param>
29
BindingSource
bindingSource,
ModelBinding\Metadata\BindingMetadata.cs (2)
21
/// Gets or sets the <see cref="ModelBinding.
BindingSource
"/>.
24
public
BindingSource
? BindingSource { get; set; }
ModelBinding\Metadata\BindingSourceMetadataProvider.cs (2)
23
public BindingSourceMetadataProvider(Type type,
BindingSource
? bindingSource)
40
public
BindingSource
? BindingSource { get; }
ModelBinding\Metadata\DefaultModelMetadata.cs (1)
167
public override
BindingSource
? BindingSource => BindingMetadata.BindingSource;
ModelBinding\QueryStringValueProvider.cs (2)
22
/// <param name="bindingSource">The <see cref="
BindingSource
"/> for the data.</param>
26
BindingSource
bindingSource,
ModelBinding\QueryStringValueProviderFactory.cs (1)
25
BindingSource
.Query,
ModelBinding\RouteValueProvider.cs (4)
22
/// <param name="bindingSource">The <see cref="
BindingSource
"/> of the data.</param>
26
BindingSource
bindingSource,
35
/// <param name="bindingSource">The <see cref="
BindingSource
"/> of the data.</param>
38
public RouteValueProvider(
BindingSource
bindingSource, RouteValueDictionary values, CultureInfo culture)
ModelBinding\RouteValueProviderFactory.cs (1)
19
BindingSource
.Path,
Microsoft.AspNetCore.Mvc.Core.Test (310)
ApplicationModels\ApiBehaviorApplicationModelProviderTest.cs (2)
78
Assert.Equal(
BindingSource
.Body, parameterModel.BindingInfo.BindingSource);
121
Assert.Equal(
BindingSource
.Body, parameterModel.BindingInfo.BindingSource);
ApplicationModels\ConsumesConstraintForFormFileParameterConventionTest.cs (1)
38
BindingSource =
BindingSource
.FormFile,
ApplicationModels\ControllerActionDescriptorBuilderTest.cs (1)
56
Assert.Equal(
BindingSource
.Query, property.BindingInfo.BindingSource);
ApplicationModels\ControllerActionDescriptorProviderTests.cs (2)
155
Assert.Equal(entity.BindingInfo.BindingSource,
BindingSource
.Body);
207
Assert.Equal(entity.BindingInfo.BindingSource,
BindingSource
.Body);
ApplicationModels\DefaultApplicationModelProviderTest.cs (20)
81
Assert.Equal(
BindingSource
.Query, property.BindingInfo.BindingSource);
90
Assert.Equal(
BindingSource
.FormFile, property.BindingInfo.BindingSource);
98
Assert.Equal(
BindingSource
.Services, property.BindingInfo.BindingSource);
116
var detailsProvider = new BindingSourceMetadataProvider(typeof(string),
BindingSource
.Special);
133
Assert.Equal(
BindingSource
.Query, property.BindingInfo.BindingSource);
142
Assert.Equal(
BindingSource
.FormFile, property.BindingInfo.BindingSource);
150
Assert.Equal(
BindingSource
.Services, property.BindingInfo.BindingSource);
159
Assert.Equal(
BindingSource
.Special, property.BindingInfo.BindingSource);
186
Assert.Equal(
BindingSource
.Query, parameter.BindingInfo.BindingSource);
195
Assert.Equal(
BindingSource
.FormFile, parameter.BindingInfo.BindingSource);
230
Assert.Equal(
BindingSource
.FormFile, parameter.BindingInfo.BindingSource);
235
Assert.Equal(
BindingSource
.FormFile, parameter.BindingInfo.BindingSource);
240
Assert.Equal(
BindingSource
.FormFile, parameter.BindingInfo.BindingSource);
245
Assert.Equal(
BindingSource
.FormFile, parameter.BindingInfo.BindingSource);
250
Assert.Equal(
BindingSource
.FormFile, parameter.BindingInfo.BindingSource);
259
var detailsProvider = new BindingSourceMetadataProvider(typeof(Guid),
BindingSource
.Special);
278
Assert.Equal(
BindingSource
.Special, parameter.BindingInfo.BindingSource);
287
var detailsProvider = new BindingSourceMetadataProvider(typeof(Guid),
BindingSource
.Special);
306
Assert.Equal(
BindingSource
.Query, parameter.BindingInfo.BindingSource);
1338
Assert.Same(
BindingSource
.Path, property.BindingInfo.BindingSource);
ApplicationModels\InferParameterBindingInfoConventionTest.cs (67)
31
Assert.Same(
BindingSource
.Custom, parameterModel.BindingInfo.BindingSource);
131
Assert.Same(
BindingSource
.Body, bindingInfo.BindingSource);
139
Assert.Equal(
BindingSource
.Special, bindingInfo.BindingSource);
165
Assert.Same(
BindingSource
.Body, bindingInfo.BindingSource);
191
Assert.Same(
BindingSource
.Body, bindingInfo.BindingSource);
217
Assert.Same(
BindingSource
.Body, bindingInfo.BindingSource);
238
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
259
Assert.Same(
BindingSource
.Custom, bindingInfo.BindingSource);
280
Assert.Same(
BindingSource
.Custom, bindingInfo.BindingSource);
293
var
result = convention.InferBindingSourceForParameter(parameter);
296
Assert.Same(
BindingSource
.Path, result);
308
var
result = convention.InferBindingSourceForParameter(parameter);
311
Assert.Same(
BindingSource
.Path, result);
323
var
result = convention.InferBindingSourceForParameter(parameter);
326
Assert.Same(
BindingSource
.Path, result);
338
var
result = convention.InferBindingSourceForParameter(parameter);
341
Assert.Same(
BindingSource
.Body, result);
353
var
result = convention.InferBindingSourceForParameter(parameter);
356
Assert.Same(
BindingSource
.Path, result);
368
var
result = convention.InferBindingSourceForParameter(parameter);
371
Assert.Same(
BindingSource
.Path, result);
383
var
result = convention.InferBindingSourceForParameter(parameter);
386
Assert.Same(
BindingSource
.Path, result);
398
var
result = convention.InferBindingSourceForParameter(parameter);
401
Assert.Same(
BindingSource
.Path, result);
413
var
result = convention.InferBindingSourceForParameter(parameter);
416
Assert.Same(
BindingSource
.Path, result);
428
var
result = convention.InferBindingSourceForParameter(parameter);
431
Assert.Same(
BindingSource
.Query, result);
443
var
result = convention.InferBindingSourceForParameter(parameter);
446
Assert.Same(
BindingSource
.Path, result);
458
var
result = convention.InferBindingSourceForParameter(parameter);
461
Assert.Same(
BindingSource
.Path, result);
473
var
result = convention.InferBindingSourceForParameter(parameter);
476
Assert.Same(
BindingSource
.Path, result);
488
var
result = convention.InferBindingSourceForParameter(parameter);
491
Assert.Same(
BindingSource
.Query, result);
503
var
result = convention.InferBindingSourceForParameter(parameter);
506
Assert.Same(
BindingSource
.Body, result);
528
Assert.Same(
BindingSource
.Body, model.BindingInfo.BindingSource);
531
Assert.Same(
BindingSource
.Special, cancellationToken.BindingInfo.BindingSource);
543
var
result = convention.InferBindingSourceForParameter(parameter);
546
Assert.Same(
BindingSource
.Query, result);
558
var
result = convention.InferBindingSourceForParameter(parameter);
561
Assert.Same(
BindingSource
.Body, result);
573
var
result = convention.InferBindingSourceForParameter(parameter);
576
Assert.Same(
BindingSource
.Body, result);
588
var
result = convention.InferBindingSourceForParameter(parameter);
591
Assert.Same(
BindingSource
.Body, result);
603
var
result = convention.InferBindingSourceForParameter(parameter);
606
Assert.Same(
BindingSource
.Body, result);
620
var
result = convention.InferBindingSourceForParameter(parameter);
624
Assert.Same(
BindingSource
.Services, result);
638
var
result = convention.InferBindingSourceForParameter(parameter);
642
Assert.Same(
BindingSource
.Services, result);
662
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
683
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
704
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
724
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
745
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
766
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
787
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
808
Assert.Same(
BindingSource
.Path, bindingInfo.BindingSource);
829
Assert.Same(
BindingSource
.Path, bindingInfo.BindingSource);
850
Assert.Same(
BindingSource
.Path, bindingInfo.BindingSource);
870
Assert.Same(
BindingSource
.Path, bindingInfo.BindingSource);
893
Assert.Same(
BindingSource
.Query, bindingInfo.BindingSource);
ApplicationModels\ParameterModelTest.cs (1)
21
BindingSource =
BindingSource
.Body
Controllers\ControllerBinderDelegateProviderTest.cs (12)
702
BindingInfo = new BindingInfo() { BindingSource =
BindingSource
.Custom },
743
BindingInfo = new BindingInfo() { BindingSource =
BindingSource
.Custom },
786
BindingSource =
BindingSource
.Custom,
799
BindingSource =
BindingSource
.Custom,
849
BindingSource =
BindingSource
.Custom,
862
BindingSource =
BindingSource
.Custom,
1095
BindingSource =
BindingSource
.Body
1107
BindingSource =
BindingSource
.Body
1405
public
BindingSource
BindingSource { get { return
BindingSource
.Custom; } }
1410
public
BindingSource
BindingSource { get { return
BindingSource
.Query; } }
ModelBinding\Binders\BodyModelBinderProviderTest.cs (8)
11
public static TheoryData<
BindingSource
> NonBodyBindingSources
15
return new TheoryData<
BindingSource
>()
17
BindingSource
.Header,
18
BindingSource
.Form,
26
public void GetBinder_WhenBindingSourceIsNotFromBody_ReturnsNull(
BindingSource
source)
49
context.BindingInfo.BindingSource =
BindingSource
.Body;
62
context.BindingInfo.BindingSource =
BindingSource
.Body;
76
context.BindingInfo.BindingSource =
BindingSource
.Body;
ModelBinding\Binders\BodyModelBinderTests.cs (22)
34
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
56
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
80
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
105
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
132
d.BindingSource =
BindingSource
.Body;
173
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
201
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
229
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
257
metadataProvider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
305
metadataProvider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
334
metadataProvider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
376
metadataProvider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
405
metadataProvider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
452
metadataProvider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
487
metadataProvider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
516
metadataProvider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
539
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
577
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
602
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
631
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
663
provider.ForType<Person>().BindingDetails(d => d.BindingSource =
BindingSource
.Body);
701
BindingSource =
BindingSource
.Body,
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (6)
221
.Setup(o => o.Filter(It.IsAny<
BindingSource
>()))
222
.Returns<
BindingSource
>(source => source ==
BindingSource
.Query ? originalValueProvider.Object : null);
1350
public
BindingSource
BindingSource
1358
public
BindingSource
BindingSource { get { return
BindingSource
.Query; } }
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (6)
220
.Setup(o => o.Filter(It.IsAny<
BindingSource
>()))
221
.Returns<
BindingSource
>(source => source ==
BindingSource
.Query ? originalValueProvider.Object : null);
1525
public
BindingSource
BindingSource
1533
public
BindingSource
BindingSource { get { return
BindingSource
.Query; } }
ModelBinding\Binders\DictionaryModelBinderTest.cs (2)
648
BindingSource
.Form,
661
return new TestValueProvider(
BindingSource
.Form, backingStore);
ModelBinding\Binders\FormFileModelBinderTest.cs (1)
437
.BindingDetails(bd => bd.BindingSource =
BindingSource
.Header);
ModelBinding\Binders\HeaderModelBinderProviderTest.cs (11)
14
public static TheoryData<
BindingSource
> NonHeaderBindingSources
18
return new TheoryData<
BindingSource
>()
20
BindingSource
.Body,
21
BindingSource
.Form,
29
public void Create_WhenBindingSourceIsNotFromHeader_ReturnsNull(
BindingSource
source)
59
context.BindingInfo.BindingSource =
BindingSource
.Header;
82
context.BindingInfo.BindingSource =
BindingSource
.Header;
108
context.BindingInfo.BindingSource =
BindingSource
.Header;
130
context.BindingInfo.BindingSource =
BindingSource
.Header;
152
context.BindingInfo.BindingSource =
BindingSource
.Header;
169
context.BindingInfo.BindingSource =
BindingSource
.Header;
ModelBinding\Binders\HeaderModelBinderTests.cs (2)
392
metadataProvider.ForType(modelType).BindingDetails(d => d.BindingSource =
BindingSource
.Header);
401
.BindingDetails(bd => bd.BindingSource =
BindingSource
.Header);
ModelBinding\Binders\ServicesModelBinderProviderTest.cs (6)
10
public static TheoryData<
BindingSource
> NonServicesBindingSources
14
return new TheoryData<
BindingSource
>()
16
BindingSource
.Header,
17
BindingSource
.Form,
25
public void Create_WhenBindingSourceIsNotFromServices_ReturnsNull(
BindingSource
source)
47
context.BindingInfo.BindingSource =
BindingSource
.Services;
ModelBinding\Binders\ServicesModelBinderTest.cs (1)
36
metadataProvider.ForType(modelType).BindingDetails(d => d.BindingSource =
BindingSource
.Services);
ModelBinding\BindingSourceValueProviderTest.cs (9)
18
var
bindingSource = new BindingSource(
39
bindingSources: new
BindingSource
[] {
BindingSource
.Query,
BindingSource
.Form },
53
var valueProvider = new TestableBindingSourceValueProvider(
BindingSource
.Query);
56
var result = valueProvider.Filter(
BindingSource
.Body);
66
var valueProvider = new TestableBindingSourceValueProvider(
BindingSource
.Query);
69
var result = valueProvider.Filter(
BindingSource
.Query);
77
public TestableBindingSourceValueProvider(
BindingSource
source)
ModelBinding\CompositeValueProviderTest.cs (8)
19
var provider = GetBindingSourceValueProvider(
BindingSource
.Query, BackingStore, culture: null);
21
var
bindingSource = new BindingSource(
22
BindingSource
.Query.Id,
36
BindingSource
bindingSource,
248
.Setup(o => o.Filter(It.Is<
BindingSource
>(s => s.Id == bindingSourceId)))
252
.Setup(o => o.Filter(It.Is<
BindingSource
>(s => s.Id != bindingSourceId)))
260
public
BindingSource
BindingSource
275
public
BindingSource
BindingSource
ModelBinding\DefaultModelBindingContextTest.cs (9)
32
d.BindingSource =
BindingSource
.Custom;
41
var
originalBindingSource = bindingContext.BindingSource;
76
new BindingInfo() { BindingSource =
BindingSource
.Query },
92
.BindingDetails(b => b.BindingSource =
BindingSource
.Query);
120
.BindingDetails(b => b.BindingSource =
BindingSource
.Form);
128
new BindingInfo() { BindingSource =
BindingSource
.Query },
172
result.Add(new RouteValueProvider(
BindingSource
.Path, new RouteValueDictionary()));
174
BindingSource
.Query,
178
BindingSource
.Form,
ModelBinding\EnumerableValueProviderTest.cs (21)
33
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, backingStore, culture: null);
46
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture: null);
64
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture: null);
74
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture: null);
94
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture: null);
107
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture: null);
129
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture: null);
147
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture: null);
161
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture);
176
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture);
194
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture);
212
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, backingStore, culture);
225
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, BackingStore, culture: null);
242
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, store, culture: null);
255
var provider = GetBindingSourceValueProvider(
BindingSource
.Query, BackingStore, culture: null);
257
var
bindingSource = new BindingSource(
258
BindingSource
.Query.Id,
275
var provider = GetBindingSourceValueProvider(
BindingSource
.Query, BackingStore, culture: null);
277
var
bindingSource = new BindingSource(
291
BindingSource
bindingSource,
304
BindingSource
bindingSource,
ModelBinding\FormValueProviderTest.cs (2)
23
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, values, culture);
38
BindingSource
bindingSource,
ModelBinding\JQueryFormValueProviderTest.cs (4)
12
BindingSource
bindingSource,
24
var provider = new JQueryFormValueProvider(
BindingSource
.Form, dictionary, CultureInfo.CurrentCulture);
41
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, store, culture: null);
61
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, values, culture);
ModelBinding\JQueryQueryStringValueProviderTest.cs (3)
12
BindingSource
bindingSource,
25
BindingSource
.Form,
44
var valueProvider = GetEnumerableValueProvider(
BindingSource
.Query, store, culture: null);
ModelBinding\Metadata\BindingSourceMetadataProviderTests.cs (2)
12
var provider = new BindingSourceMetadataProvider(typeof(Test),
BindingSource
.Special);
22
Assert.Equal(
BindingSource
.Special, context.BindingMetadata.BindingSource);
ModelBinding\Metadata\BindingSourceTest.cs (27)
15
$"'{nameof(
BindingSource
.CanAcceptDataFrom)}' requires that the source must represent a single type of input.";
18
bindingSources: new
BindingSource
[] {
BindingSource
.Query,
BindingSource
.Form },
23
() =>
BindingSource
.Query.CanAcceptDataFrom(bindingSource),
28
public static TheoryData<
BindingSource
> ModelBinding_MatchData
32
return new TheoryData<
BindingSource
>
34
BindingSource
.Form,
35
BindingSource
.ModelBinding,
36
BindingSource
.Path,
37
BindingSource
.Query,
44
public void ModelBinding_CanAcceptDataFrom_Match(
BindingSource
bindingSource)
47
var result =
BindingSource
.ModelBinding.CanAcceptDataFrom(bindingSource);
57
var result =
BindingSource
.Query.CanAcceptDataFrom(
BindingSource
.Query);
63
public static TheoryData<
BindingSource
> ModelBinding_NoMatchData
67
return new TheoryData<
BindingSource
>
69
BindingSource
.Body,
70
BindingSource
.Custom,
71
BindingSource
.FormFile,
72
BindingSource
.Header,
73
BindingSource
.Services,
74
BindingSource
.Special,
81
public void ModelBinding_CanAcceptDataFrom_NoMatch(
BindingSource
bindingSource)
84
var result =
BindingSource
.ModelBinding.CanAcceptDataFrom(bindingSource);
94
var result =
BindingSource
.Query.CanAcceptDataFrom(
BindingSource
.Path);
ModelBinding\Metadata\CompositeBindingSourceTest.cs (14)
15
bindingSources: new
BindingSource
[] {
BindingSource
.Query,
BindingSource
.Form },
19
bindingSources: new
BindingSource
[] {
BindingSource
.Query,
BindingSource
.Form },
37
bindingSources: new
BindingSource
[] {
BindingSource
.Query,
BindingSource
.Form },
41
var result = composite.CanAcceptDataFrom(
BindingSource
.Query);
52
bindingSources: new
BindingSource
[] {
BindingSource
.Query,
BindingSource
.Form },
56
var result = composite.CanAcceptDataFrom(
BindingSource
.Path);
ModelBinding\Metadata\DefaultBindingMetadataProviderTest.cs (7)
111
new BindingSourceModelBinderAttribute(
BindingSource
.Body),
112
new BindingSourceModelBinderAttribute(
BindingSource
.Query),
125
Assert.Equal(
BindingSource
.Body, context.BindingMetadata.BindingSource);
135
new BindingSourceModelBinderAttribute(
BindingSource
.Body),
136
new BindingSourceModelBinderAttribute(
BindingSource
.Query),
149
Assert.Equal(
BindingSource
.Body, context.BindingMetadata.BindingSource);
894
public BindingSourceModelBinderAttribute(
BindingSource
bindingSource)
ModelBinding\Metadata\ModelBinderAttributeTest.cs (9)
17
var
source = attribute.BindingSource;
33
var
source = attribute.BindingSource;
36
Assert.Same(
BindingSource
.Custom, source);
46
var
source = attribute.BindingSource;
49
Assert.Same(
BindingSource
.Custom, source);
62
var
source = attribute.BindingSource;
65
Assert.Equal(
BindingSource
.Query, source);
70
public override
BindingSource
BindingSource =>
BindingSource
.Query;
ModelBinding\ModelBinderFactoryTest.cs (4)
296
BindingSource =
BindingSource
.Services,
305
BindingSource =
BindingSource
.ModelBinding,
310
BindingSource =
BindingSource
.Services,
317
BindingSource =
BindingSource
.Services,
ModelBinding\QueryStringValueProviderTest.cs (1)
13
BindingSource
bindingSource,
ModelBinding\RouteValueProviderTests.cs (17)
20
var provider = new RouteValueProvider(
BindingSource
.Query, values);
37
var provider = new RouteValueProvider(
BindingSource
.Query, values);
55
var provider = new RouteValueProvider(
BindingSource
.Query, values);
72
var provider = new RouteValueProvider(
BindingSource
.Query, values, new CultureInfo("de-CH"));
91
var provider = new RouteValueProvider(
BindingSource
.Query, values);
108
var provider = new RouteValueProvider(
BindingSource
.Query, values);
126
var provider = new RouteValueProvider(
BindingSource
.Query, values, culture);
148
var valueProvider = new RouteValueProvider(
BindingSource
.Query, values);
169
var valueProvider = new RouteValueProvider(
BindingSource
.Query, values);
187
var valueProvider = new RouteValueProvider(
BindingSource
.Query, values);
204
var provider = new RouteValueProvider(
BindingSource
.Query, values);
221
var provider = new RouteValueProvider(
BindingSource
.Query, values);
235
var provider = new RouteValueProvider(
BindingSource
.Query, values);
237
var
bindingSource = new BindingSource(
238
BindingSource
.Query.Id,
256
var provider = new RouteValueProvider(
BindingSource
.Query, values);
258
var
bindingSource = new BindingSource(
ModelBinding\TestValueProvider.cs (2)
10
public static readonly
BindingSource
TestBindingSource = new BindingSource(
23
public TestValueProvider(
BindingSource
bindingSource, IDictionary<string, object> values)
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (1)
ModelMetadataProviderTest.cs (1)
924
public
BindingSource
BindingSource { get; set; }
Microsoft.AspNetCore.Mvc.FunctionalTests (15)
ApiExplorerTest.cs (15)
979
Assert.Equal(
BindingSource
.ModelBinding.Id, i.Source);
983
Assert.Equal(
BindingSource
.ModelBinding.Id, s.Source);
1004
Assert.Equal(
BindingSource
.Query.Id, i.Source);
1008
Assert.Equal(
BindingSource
.Path.Id, s.Source);
1028
Assert.Equal(
BindingSource
.ModelBinding.Id, id.Source);
1032
Assert.Equal(
BindingSource
.ModelBinding.Id, name.Source);
1052
Assert.Equal(
BindingSource
.Path.Id, id.Source);
1056
Assert.Equal(
BindingSource
.Body.Id, product.Source);
1076
Assert.Equal(
BindingSource
.Query.Id, customerId.Source);
1080
Assert.Equal(
BindingSource
.Header.Id, referrer.Source);
1084
Assert.Equal(
BindingSource
.Form.Id, quantity.Source);
1088
Assert.Equal(
BindingSource
.Form.Id, productId.Source);
1092
Assert.Equal(
BindingSource
.Form.Id, productName.Source);
1096
Assert.Equal(
BindingSource
.Query.Id, shippingInstructions.Source);
1100
Assert.Equal(
BindingSource
.Form.Id, feedback.Source);
Microsoft.AspNetCore.Mvc.IntegrationTests (42)
BodyValidationIntegrationTests.cs (11)
29
BindingSource =
BindingSource
.Body
71
BindingSource =
BindingSource
.Body,
103
BindingSource =
BindingSource
.Body
153
BindingSource =
BindingSource
.Body
194
BindingSource =
BindingSource
.Body
234
BindingSource =
BindingSource
.Body
270
BindingSource =
BindingSource
.Body
315
BindingSource =
BindingSource
.Body
405
BindingSource =
BindingSource
.Body
816
.BindingDetails(binding => binding.BindingSource =
BindingSource
.Body);
862
.BindingDetails(binding => binding.BindingSource =
BindingSource
.Body);
GenericModelBinderIntegrationTest.cs (4)
133
public static readonly
BindingSource
Source = new BindingSource(
139
public
BindingSource
BindingSource
152
var
allowedBindingSource = context.BindingInfo.BindingSource;
172
var
allowedBindingSource = bindingContext.BindingSource;
HeaderModelBinderIntegrationTest.cs (1)
270
BindingSource =
BindingSource
.Header
ModelPrefixSelectionIntegrationTest.cs (3)
77
BindingSource =
BindingSource
.Query,
165
BindingSource =
BindingSource
.Query,
214
BindingSource =
BindingSource
.Query,
ServicesModelBinderIntegrationTest.cs (10)
24
BindingSource =
BindingSource
.Services
61
BindingSource =
BindingSource
.Services,
97
BindingSource =
BindingSource
.Services,
133
BindingSource =
BindingSource
.Services,
169
BindingSource =
BindingSource
.Services,
206
BindingSource =
BindingSource
.Services,
239
BindingSource =
BindingSource
.Services,
275
BindingSource =
BindingSource
.Services,
308
BindingSource =
BindingSource
.Services,
390
.BindingDetails(binding => binding.BindingSource =
BindingSource
.Services);
SimpleTypeModelBinderIntegrationTest.cs (1)
288
BindingSource =
BindingSource
.Body,
ValidationIntegrationTests.cs (6)
57
BindingSource =
BindingSource
.Body
69
BindingSource =
BindingSource
.Body
1783
BindingSource =
BindingSource
.Body
1873
BindingSource =
BindingSource
.Body
1919
BindingSource =
BindingSource
.Body
1974
BindingSource =
BindingSource
.Body
ValidationWithRecordIntegrationTests.cs (6)
49
BindingSource =
BindingSource
.Body
61
BindingSource =
BindingSource
.Body
1586
BindingSource =
BindingSource
.Body
1676
BindingSource =
BindingSource
.Body
1722
BindingSource =
BindingSource
.Body
1773
BindingSource =
BindingSource
.Body
Microsoft.AspNetCore.Mvc.RazorPages.Test (5)
ApplicationModels\DefaultPageApplicationModelProviderTest.cs (5)
165
Assert.Equal(
BindingSource
.Path, property.BindingInfo.BindingSource);
207
Assert.Equal(
BindingSource
.Path, property.BindingInfo.BindingSource);
355
Assert.Equal(
BindingSource
.Query, property.BindingInfo.BindingSource);
363
Assert.Equal(
BindingSource
.Services, property.BindingInfo.BindingSource);
393
Assert.Equal(
BindingSource
.Path, property.BindingInfo.BindingSource);
Microsoft.AspNetCore.Mvc.Test (5)
MvcOptionsSetupTest.cs (5)
176
Assert.Equal(
BindingSource
.Special, specialParameter.BindingSource);
182
Assert.Equal(
BindingSource
.FormFile, formFileParameter.BindingSource);
188
Assert.Equal(
BindingSource
.FormFile, formCollectionParameter.BindingSource);
194
Assert.Equal(
BindingSource
.FormFile, formFileParameter.BindingSource);
200
Assert.Equal(
BindingSource
.FormFile, formFileParameter.BindingSource);
Microsoft.AspNetCore.OpenApi (14)
Extensions\ApiDescriptionExtensions.cs (6)
83
apiParameterDescription.Source ==
BindingSource
.Body ||
84
apiParameterDescription.Source ==
BindingSource
.FormFile ||
85
apiParameterDescription.Source ==
BindingSource
.Form;
95
formParameters = apiDescription.ParameterDescriptions.Where(parameter => parameter.Source ==
BindingSource
.Form || parameter.Source ==
BindingSource
.FormFile);
108
var bodyParameters = apiDescription.ParameterDescriptions.Where(parameter => parameter.Source ==
BindingSource
.Body);
Extensions\JsonNodeSchemaExtensions.cs (6)
344
static bool SupportsNullableProperty(
BindingSource
bindingSource) =>bindingSource ==
BindingSource
.Header
345
|| bindingSource ==
BindingSource
.Query
346
|| bindingSource ==
BindingSource
.Path
347
|| bindingSource ==
BindingSource
.Form
348
|| bindingSource ==
BindingSource
.FormFile;
Services\OpenApiDocumentService.cs (2)
433
else if (parameter.Source ==
BindingSource
.Header && _disallowedHeaderParameters.Contains(parameter.Name))
450
return parameter.Source ==
BindingSource
.Path || parameter.IsRequired || hasRequiredAttribute;