101 references to ModelBindingHelper
Microsoft.AspNetCore.Mvc.Core (18)
ControllerBase.cs (7)
2582
return
ModelBindingHelper
.TryUpdateModelAsync(
2619
return await
ModelBindingHelper
.TryUpdateModelAsync(
2656
return await
ModelBindingHelper
.TryUpdateModelAsync(
2691
return
ModelBindingHelper
.TryUpdateModelAsync(
2725
return
ModelBindingHelper
.TryUpdateModelAsync(
2760
return await
ModelBindingHelper
.TryUpdateModelAsync(
2795
return
ModelBindingHelper
.TryUpdateModelAsync(
ModelBinding\Binders\CollectionModelBinder.cs (2)
293
boundCollection.Add(
ModelBindingHelper
.CastOrDefault<TElement>(boundValue));
375
boundCollection.Add(
ModelBindingHelper
.CastOrDefault<TElement>(boundValue));
ModelBinding\Binders\DictionaryModelBinder.cs (2)
169
convertedKey =
ModelBindingHelper
.ConvertTo<TKey>(kvp.Key, culture: null);
208
model[convertedKey] =
ModelBindingHelper
.CastOrDefault<TValue>(valueResult.Model);
ModelBinding\Binders\FormFileModelBinder.cs (2)
41
if (!createFileCollection && !
ModelBindingHelper
.CanGetCompatibleCollection<IFormFile>(bindingContext))
54
postedFiles =
ModelBindingHelper
.GetCompatibleCollection<IFormFile>(bindingContext);
ModelBinding\Binders\HeaderModelBinder.cs (2)
133
else if (
ModelBindingHelper
.CanGetCompatibleCollection<string>(bindingContext))
179
var collection =
ModelBindingHelper
.GetCompatibleCollection<string>(bindingContext, values.Length);
ModelBinding\Binders\KeyValuePairModelBinder.cs (2)
54
ModelBindingHelper
.CastOrDefault<TKey?>(keyResult.Model),
55
ModelBindingHelper
.CastOrDefault<TValue?>(valueResult.Model));
ModelBinding\DefaultPropertyFilterProvider.cs (1)
50
var expression =
ModelBindingHelper
.GetPropertyFilterExpression(includeExpressions.ToArray());
Microsoft.AspNetCore.Mvc.Core.Test (67)
ModelBinding\Binders\CollectionModelBinderTest.cs (1)
517
var model =
ModelBindingHelper
.ConvertTo(valueToConvert, context.ModelType, value.Culture);
ModelBinding\ModelBindingHelperTest.cs (66)
32
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
73
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
113
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
137
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
191
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
217
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
267
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
318
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
342
var propertyName =
ModelBindingHelper
.GetPropertyName(expression.Body);
356
ModelBindingHelper
.GetPropertyName(expression.Body));
397
ModelBindingHelper
.GetPropertyName(expression.Body));
416
ModelBindingHelper
.GetPropertyName(expression.Body));
432
ModelBindingHelper
.GetPropertyName(expression.Body));
448
ModelBindingHelper
.GetPropertyName(expression.Body));
466
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
521
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
549
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
589
var result = await
ModelBindingHelper
.TryUpdateModelAsync(
620
() =>
ModelBindingHelper
.TryUpdateModelAsync(
651
ModelBindingHelper
.ClearValidationStateForModel(modelMetadata, dictionary, modelKey);
680
ModelBindingHelper
.ClearValidationStateForModel(modelMetadata, dictionary, modelKey);
711
ModelBindingHelper
.ClearValidationStateForModel(modelMetadata, dictionary, modelKey);
756
ModelBindingHelper
.ClearValidationStateForModel(modelMetadata, dictionary, prefix);
845
var convertedValue =
ModelBindingHelper
.ConvertTo(value: null, type: typeof(string), culture: null);
852
var convertedValue =
ModelBindingHelper
.ConvertTo(value: null, type: typeof(int), culture: null);
863
var converted =
ModelBindingHelper
.ConvertTo(value, typeof(string), culture: null);
876
var converted =
ModelBindingHelper
.ConvertTo<string[]>(value, culture: null);
890
var converted =
ModelBindingHelper
.ConvertTo<string>(42, culture: null);
903
var returned =
ModelBindingHelper
.ConvertTo<int?>(value: null, culture: null);
916
var returned =
ModelBindingHelper
.ConvertTo<int?>(original, culture: null);
928
var outValue =
ModelBindingHelper
.ConvertTo(new string[] { null }, typeof(int), culture: null);
940
var outValue =
ModelBindingHelper
.ConvertTo(new int[0], typeof(int), culture: null);
953
var outValue =
ModelBindingHelper
.ConvertTo(value, typeof(int), culture: null);
965
var outValue =
ModelBindingHelper
.ConvertTo(value: null, type: typeof(int[]), culture: null);
977
var outValue =
ModelBindingHelper
.ConvertTo(new object[] { 1 }, typeof(IntEnum), culture: null);
1010
var outValue =
ModelBindingHelper
.ConvertTo(new object[] { input }, enumType, culture: null);
1022
var outValue =
ModelBindingHelper
.ConvertTo(new object[] { "1" }, typeof(IntEnum), culture: null);
1034
var outValue =
ModelBindingHelper
.ConvertTo(new object[] { "Value1" }, typeof(IntEnum), culture: null);
1046
var outValue =
ModelBindingHelper
.ConvertTo("12", typeof(int?), culture: null);
1058
var outValue =
ModelBindingHelper
.ConvertTo("12.5", typeof(double?), culture: null);
1070
var outValue =
ModelBindingHelper
.ConvertTo(12M, typeof(int?), culture: null);
1082
var outValue =
ModelBindingHelper
.ConvertTo(12.5M, typeof(double?), culture: null);
1094
var outValue =
ModelBindingHelper
.ConvertTo(12M, typeof(int?), culture: null);
1106
var outValue =
ModelBindingHelper
.ConvertTo(12M, typeof(long?), culture: null);
1118
var outValue =
ModelBindingHelper
.ConvertTo(new object[] { "some string" }, typeof(string), culture: null);
1133
var outValue =
ModelBindingHelper
.ConvertTo(value, typeof(IntEnum[]), culture: null);
1151
var outValue =
ModelBindingHelper
.ConvertTo(value, typeof(FlagsEnum[]), culture: null);
1167
var outValue =
ModelBindingHelper
.ConvertTo(original, typeof(string[]), culture: null);
1183
() =>
ModelBindingHelper
.ConvertTo("this-is-not-a-valid-value", destinationType, culture: null));
1192
var cultureResult =
ModelBindingHelper
.ConvertTo("12,5", typeof(decimal), new CultureInfo("fr-FR"));
1197
() =>
ModelBindingHelper
.ConvertTo("12,5", typeof(decimal), new CultureInfo("en-GB")));
1207
Assert.Equal(expectedValue,
ModelBindingHelper
.ConvertTo(initialValue, typeof(T), culture: null));
1250
() =>
ModelBindingHelper
.ConvertTo(new MyClassWithoutConverter(), destinationType, culture: null));
1266
() =>
ModelBindingHelper
.ConvertTo(value, destinationType, culture: null));
1280
var result =
ModelBindingHelper
.ConvertTo(value, destinationType, culture: null);
1300
var result =
ModelBindingHelper
.ConvertTo(value, destinationType, culture: null);
1325
var outValue =
ModelBindingHelper
.ConvertTo<FlagsEnum>(value, culture: null);
1349
var result =
ModelBindingHelper
.CanGetCompatibleCollection<int>(bindingContext);
1370
var result =
ModelBindingHelper
.GetCompatibleCollection<int>(bindingContext);
1386
var result =
ModelBindingHelper
.GetCompatibleCollection<int>(bindingContext);
1399
var result =
ModelBindingHelper
.GetCompatibleCollection<int>(bindingContext, capacity: 23);
1420
var result =
ModelBindingHelper
.CanGetCompatibleCollection<int>(bindingContext);
1436
var result =
ModelBindingHelper
.CanGetCompatibleCollection<int>(bindingContext);
1451
var result =
ModelBindingHelper
.GetCompatibleCollection<int>(bindingContext);
1467
var result =
ModelBindingHelper
.GetCompatibleCollection<int>(bindingContext);
1487
var result =
ModelBindingHelper
.CanGetCompatibleCollection<int>(bindingContext);
Microsoft.AspNetCore.Mvc.IntegrationTests (1)
TryUpdateModelIntegrationTest.cs (1)
1360
return await
ModelBindingHelper
.TryUpdateModelAsync(
Microsoft.AspNetCore.Mvc.RazorPages (14)
PageBase.cs (7)
1331
return
ModelBindingHelper
.TryUpdateModelAsync(
1367
return await
ModelBindingHelper
.TryUpdateModelAsync(
1403
return await
ModelBindingHelper
.TryUpdateModelAsync(
1437
return
ModelBindingHelper
.TryUpdateModelAsync(
1470
return
ModelBindingHelper
.TryUpdateModelAsync(
1504
return await
ModelBindingHelper
.TryUpdateModelAsync(
1538
return
ModelBindingHelper
.TryUpdateModelAsync(
PageModel.cs (7)
236
return
ModelBindingHelper
.TryUpdateModelAsync(
272
return await
ModelBindingHelper
.TryUpdateModelAsync(
308
return await
ModelBindingHelper
.TryUpdateModelAsync(
342
return
ModelBindingHelper
.TryUpdateModelAsync(
375
return
ModelBindingHelper
.TryUpdateModelAsync(
409
return await
ModelBindingHelper
.TryUpdateModelAsync(
443
return
ModelBindingHelper
.TryUpdateModelAsync(
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
DefaultHtmlGenerator.cs (1)
1068
return
ModelBindingHelper
.ConvertTo(entry.RawValue, destinationType, culture: null);