michaellperry/UpdateControls — pull request #12 by robertvazan (2014-07-08 00:19:11+00:00)
Title: Do not wrap primitive types from typeof(object) properties

This is a small fix. When #9 introduced wrapping for `object` properties, UpdateControls started wrapping primitive values if they happened to be stored in such property. This fix checks actual type of the value stored in `object` property and wraps it only if it is not primitive type.

This adds to my argument that wrapping decisions must be done at runtime. In WPF, there are bound to be many such untyped `object` properties that can carry primitive values and complex models with equal probability. The logic in ClassMember is fatally flawed since it relies on incomplete compile-time type information.

IMO, checking compile-time type of the property is merely an optimization. It is useful to avoid having to do runtime checks in the usual case of strongly typed property, but it shouldn't replace the runtime mechanism entirely as it is unable to handle weakly typed properties.