Closed 0x15e closed 4 years ago
Hi there,
Thanks very much for this very well put together issue. I'd be happy to accept a pull request and work with you to get this merged. I thought there may be some issues around dynamics but didn't have the knowledge to improve it so thank you very much!
@Romanx sounds good. This has been a learning experience for me too. :)
I was thinking of doing an implementation where it tries the existing approach first because it's bound to be faster, then using the IDynamicMetaObjectProvider
approach next if that doesn't work.
I should have some time today to polish up that gist and will try to have a PR for you in the next few days.
That sounds like a great idea, will look forward to it!
@Romanx any chance you've had an opportunity to review that PR?
@0x15e Thanks for your contribution. I got it merged and released today in version 1.8.4. Please let me know if you have any issues.
I just got done troubleshooting a problem with Stubble not resolving properties on a custom object derived from
DynamicObject
and after seriously starting to doubt my sanity, finally found the culprit in the default value getters that were being set in RendererSettingsDefaults.cs. The default getters only work on dynamic objects that implementIDictionary<string, object>
.That works fine for
ExpandoObject
but doesn't work for anything that derives fromDynamicObject
or just implementsIDynamicMetaObjectProvider
without implementingIDictionary<string, object>
.I've put together a value getter that works using
IDynamicMetaObjectProvider
and theCallSite
APIs and while it should cover more cases, I haven't tested performance and was hoping we could discuss it a bit before I submit a PR for it.The Gist for it is here: https://gist.github.com/0x15e/eb220c9c639b148fd3a26ae5edc49f09