CefSharp icon indicating copy to clipboard operation
CefSharp copied to clipboard

Feature Request - Improve DefaultBinder

Open amaitland opened this issue 6 years ago • 0 comments

  • [ ] 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

Looks like we have to modify our code to get the converter based on type, probably look something like:

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

amaitland avatar May 23 '20 03:05 amaitland