Describe the feature
Currently TypeConverter uses __Deserialize which calls NormalizeInput, Validate and eventually ThrowWhenValidationFails. While this allows Vogen to work for ASP.NET, it means model binding will throw for invalid values, before validation can be done. This makes it very difficult to use in common scenarios.
Hooking into the ASP.NET validation pipeline would probably be too much, but it'd be nice if we could bind to ValueObjectOrError<T> for a no-throw model binding path.
This would also also allow one to create a ValidationAttribute that simply picks up the ValueObjectOrError<T>.Error property and adds it to the ModelStateDictionary if it's not Ok.
Describe the feature
Currently TypeConverter uses
__Deserializewhich callsNormalizeInput,Validateand eventuallyThrowWhenValidationFails. While this allows Vogen to work for ASP.NET, it means model binding will throw for invalid values, before validation can be done. This makes it very difficult to use in common scenarios.Hooking into the ASP.NET validation pipeline would probably be too much, but it'd be nice if we could bind to
ValueObjectOrError<T>for a no-throw model binding path.This would also also allow one to create a
ValidationAttributethat simply picks up theValueObjectOrError<T>.Errorproperty and adds it to theModelStateDictionaryif it's notOk.