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