You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bindingContext.ModelState.TryAddModelError(bindingContext.ModelName,$"Cannot convert a string to type \"{typeof(T).Name}\".");
73
+
returnTask.CompletedTask;
74
+
}
75
+
76
+
if(valueisnull&&_keyType.IsValueType)
77
+
{
78
+
bindingContext.ModelState.TryAddModelError(bindingContext.ModelName,$"Cannot convert null to type \"{typeof(T).Name}\".");
79
+
returnTask.CompletedTask;
80
+
}
81
+
82
+
key=_keyConverter.ConvertFrom(
83
+
null,
84
+
valueProviderResult.Culture,
85
+
value!);
86
+
}
87
+
88
+
if(keyisnull)
89
+
{
90
+
if(_disallowDefaultValues)
91
+
{
92
+
bindingContext.ModelState.TryAddModelError(bindingContext.ModelName,$"Cannot convert null to type \"{typeof(T).Name}\" because it doesn't allow default values.");
bindingContext.ModelState.TryAddModelError(bindingContext.ModelName,$"Cannot convert null to type \"{typeof(T).Name}\" because it doesn't allow default values.");
bindingContext.ModelState.TryAddModelError(bindingContext.ModelName,validationError.ToString()??$"There is no item of type '{typeof(T).Name}' with the identifier '{key}'.");
Copy file name to clipboardExpand all lines: test/Thinktecture.Runtime.Extensions.AspNetCore.Tests/AspNetCore/ModelBinding/ValueObjectModelBinderProviderTests/GetBinder.cs
+16-2Lines changed: 16 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,24 @@ public void Should_return_binder_for_int_based_enum()
0 commit comments