19 Commits

Author SHA1 Message Date
Alex Maitland fa4a37a8b0 Core - Add EvaluateScriptAsync<T>(string script) extension method
- Add generic overload that uses the DefaultBinder (with CamelCaseNaming)
  to perform type conversion
2023-03-10 18:37:42 +10:00
Alex Maitland 1d1b6f2e4d Core - Xml Doc improvements/fixes 2021-07-05 11:38:55 +10:00
Alex Maitland b5a83f526e Enhancement - Pluggable Javascript Naming (#3141)
* Core - Move NameConverter to IJavascriptObjectRepository

- Move NameConverter property from BindingOptions to IJavascriptObjectRepository
- Remove BindingOptions.CamelCaseJavascriptNames

**Breaking Change**

Follow up to https://github.com/cefsharp/CefSharp/commit/898ca38e7a7261b3a42c33b2abf5eac6c022ddde

* Core - Javascript Binding Pluggable Naming Improvements

- Added some basic unit tests (more required)
- DefaultBinder now accepts a IJavascriptNameConverter passed into the constructor
  to allow for conversion of names

* Core - Replace WeakReference with WeakReference<T>
2020-07-27 20:13:16 +10:00
amaitland ef590444b4 Core - DefaultBinder InvalidOperationException when binding [1,2,3,1.23] to double[]
- Bind for all elements in a collection, not just when the collection contains list/arrays
- Add additional unit tests

JavaScript array of [1,2,3,1.23] translates to [int, int, int, double], when attempting to Bind
to a double[] an InvalidOperationException was thrown. We now call Bind for each element,
when the type is directly assignable we return the value, for cases like above we perform a
type conversion.

Resolves #3129
2020-05-18 09:13:02 +10:00
amaitland 39a305cac1 Xml Doc - Improvements and fixes
- Some classes are now excluded
- Many minor fixes should hopefully reduce the number of errors reported by Sandcastle
- Some of the xml doc is generated by Atomineer, usually in cases where CEF lacks documentation
2020-01-29 05:36:54 +10:00
amaitland e902f4ad73 DefaultBinder - Fix bug introduced by refactoring
https://github.com/cefsharp/CefSharp/commit/8d5556e3689278b91e54099f349b3779c2c809f2
2019-10-05 13:51:23 +10:00
amaitland 8d5556e368 DefaultBinder - Performance Improvements and code simplification
- Major refactor, greatly simplified code
- Performance improvements

Breaking changes
2019-10-04 17:46:33 +10:00
amaitland 396e2cb5b8 ModelBinding - Major refactor
- Remove unused IFieldNameConverter/DefaultFieldNameConverter
- DefaultBinder remove blacklistnames
2019-10-04 14:41:45 +10:00
amaitland 294c0b2f63 IBinder/DefaultBinder - Rename modelType to targetParamType
Hopefully param names makes the intent clearer
2019-09-27 08:00:25 +10:00
Chris bef5dd37c4 Maintenance - Fixed formatting, file encoding, and copyright year (#2504)
* Applied formatting

* Fixed file encoding + Updated copyright year

* Updated License

* Fixed more file encoding

* Copyright notice now shows the year the file was created
2018-09-10 10:41:13 +10:00
amaitland 8ed2681619 Xml Doc - Add some more xml doc
Some of it's just placeholder doc to keep sandcastle happy
2018-09-05 13:01:41 +10:00
amaitland 67b8b038af Untabify
Follow up to #2218
2018-01-18 11:51:09 +10:00
João Neves b1b8f43859 Dont discard null Values from arrays (#2218)
* Don't discard arrays that contain null values
* Revert unintended change in this branch
* Added qunit test
* Code review and added new tests
2018-01-18 11:46:58 +10:00
João Neves 206e419786 Fix enums, integer and doubles binding behavior (#2219)
* Fix enums binding behavior

* Whitespace cleanups
2018-01-08 14:33:02 +10:00
amaitland 7a0b06ad0b JSB Add support for dynamic keyword (using ExpandoObject)
As ExpandoObject implements IDictionary we can use it interchangeable with only minor breaking changes.
Those expecting Dictionary<string, object> should change to IDictionary<string, object> or ExpandoObject for their param types
This will also impact anyone who has implemented their own custom IBinder
I'd suggest changing the type checking from explicitly checking Dictionary<string, object> to use Type.IsAssignableFrom or another method of comparison
DefaultBinder binder has been updated to accommodate ExpandoObject (now being returned by ObjectsSerialization.cpp)
Add new async binding for testing new assignment method
Rewrite some of the async bound object tests to use await and let - modernize them
2017-12-21 13:00:36 +10:00
amaitland 0d48e30418 Update DefaultBinder to directly set if Type.IsAssignableFrom is true - greatly simplifies the code
Remove IsCollectionOrArray extension method, use the long hand - makes the code more readable.
Switch to using Activator.CreateInstance directly
Remove a large number of unused extensions in ModelBindingExtensions
Alternate to #2052
2017-05-30 14:28:14 +10:00
Chris cd934267c6 Updated copyright year and made sure it used same format everywhere (#1966) 2017-03-06 08:44:37 +10:00
amaitland 84930b0784 Update sandcastle help file version numbers to 55.0.0
Fix some other xml comments and remove some unused fields - still lots of comments that could be added
2017-02-06 15:00:45 +10:00
Alex Maitland d4feffb554 Feature - Add IBinder (#1749)
* Add basic ModelBinding which was imported from NancyFx framework - more can be stripped out that's unused

* Add IBinder as a param when registering an object for binding
Binding is disabled by default

* Add license and remove unused using statements

* Make bind method virtual to allow for overriding
Make methods protected

* Add very basic collection support - only primitive types supported for now.
Remove unused exceptions

* Support binding a list of sub objects

* Add null check for null params

* Add BindingOptions class - remove binder and CamelCaseJavascriptNames properties - allow for additional options in the future
Breaking change.

* Add support for List<object> binding type
2016-07-20 13:38:24 +10:00