clay

How do we check whether a dynamic clay object has a property?

烂漫一生 提交于 2020-01-15 05:53:09
问题 I have a dynamic object, that I think is implemented with Clay . It has one of two possible property names. I want to use which ever property name is available. The following doesn't work: dynamic workItemPart = item.WorkItem; // is an Orchard.ContentManagement.ContentPart var learnMore = workItemPart.LearnMore ?? workItemPart.LearnMoreField; It throws a Microsoft.CSharp.RuntimeBinder.RuntimeBinderException : does not contain a definition for 'LearnMore' How do we check if a dynamic Clay

Make new object with reflection?

倾然丶 夕夏残阳落幕 提交于 2019-12-25 07:50:16
问题 I'm not sure if this is possible and after lengthy research I haven't found something conclusive. I am trying to dynamically create a new object (itself a new Type) from a dictionary. So say I have key and value that key and value will become a property that returns the value. Something that I can use like this: Sample code public T getObject(Dictionary<string, string> myDict) { // make a new object type with the keys and values of the dictionary. // sample values in dictionary: // id :

Is Orchard.ContentManagement.ContentPart implemented with Clay?

半世苍凉 提交于 2019-12-24 07:03:10
问题 I previously asked How do we check whether a dynamic clay object has a property? My question assumed that an Orchard.ContentManagement.ContentPart was a dynamic Clay object. Is it a dynamic Clay object? 回答1: No. It used to be the case, but it was recently removed, and replaced with several more specialized, and faster implementations of dynamic. The Clay dependency is completely gone. 来源: https://stackoverflow.com/questions/25166799/is-orchard-contentmanagement-contentpart-implemented-with