Clay to Json?

Feb 1, 2011 at 5:37 PM

Has anybody attempted this? 

Feb 1, 2011 at 6:07 PM

Not that I know of but it's an interesting idea.

Feb 1, 2011 at 6:11 PM

To me it is a crucial part or what I am attempting... let me see what NewtonSoft Json provides

Feb 1, 2011 at 6:21 PM

Oh, OK. What are you attempting?

Feb 1, 2011 at 6:29 PM

I am building an "framework" for MDD (model driven development) where one could execute the model at any time and verify it. Anyway, do you know if we track all members that have been assigned to a clay type. I see in the source code that ClayMetaObject throws an exception for GetDynamicMemberNames.  Is this just not implemented but we have them, or we don't keep track of them at all. I was thinking that maybe I could try implementing ISerializable or something. If not, i might have to write json myself, as I have metadata.

Feb 1, 2011 at 6:35 PM

Yeah, the thing is, Clay is extensible and extensions may create members on the fly from arbitrary conventions on names, making it impossible to have general purpose enumeration of members. Unless I'm missing something. I suppose we could enumerate what was explicitly set using the default property logic. You may be able to make that work if you dig a little in the Clay code and tweak it.

Otherwise, if you do know your schema from else where that may be your best bet.

Feb 1, 2011 at 6:42 PM

Not the answer I was hoping for, but it is one I was expecting. Oh well, have to roll up my sleeves :)

Feb 1, 2011 at 7:42 PM

Got a problem, not sure if it is a bug with clay. In "SubclassFromAnythingMembersRemainAvailableStaticallyAndDynamicallyAndViaInterface" test following does not work

Assert.That(dynamically["Hello"], Is.EqualTo("World"));

It looks like that members that are  defined in the base class cannot be accessed via indexer. Is that true, should it be true?