Feature Request - Improve DefaultBinder
- Dominant language
- C#
- Stars
- 10.3k
- Forks
- 2.9k
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 4
Description
- [ ] Add support for converting string to `GUID`.
- [ ] Add base class for use with `CefSharp.Extensions.ModelBinding.StrictModelBinder`
- [ ] Add additional unit tests
The framework has a [GuidConverter](https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.guidconverter?view=netframework-4.5.2)
Looks like we have to modify our code to get the converter based on type, probably look something like:
```c#
var typeConverter = TypeDescriptor.GetConverter(targetType);
//See if the TypeConverter for the targetType
//can convert From our object.
//NOTE: This differs from our previous implementation where
// we get the TypeConverter based on our object type and
//attempted to ConvertTo our target type.
if (typeConverter.CanConvertFrom(objType))
{
return typeConverter.ConvertFrom(obj);
}
```
This should also make it possible to add a custom type conversion as detailed in https://stackoverflow.com/a/606992/4583726
Related issue #3129
Contributor guide
Assessment
This issue has not been assessed yet.