cefsharp / cefsharp/CefSharp

Feature Request - Improve DefaultBinder

Open
#3,137 0 comments 0 reactions 0 assignees View on GitHub
feature-request
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.