Exposing a ContentType to an external application

Topics: Writing modules
May 4, 2011 at 10:24 AM

Ok something differend, we have the need to expose a ContentItem in a static way.. once it's contentType is defined.

An external application (workflow fondation 4.0) needs an InArgument of a strongly-typed class or DataContract. (or Receive message)
The DataContract could be a contentItem and the parts could be DataMembers. Properties around each field, staticly.. as DataMembers
Or everything just serializable..

In other words i think we'll create a new module that can expose contentitems based.
Perhaps dynamicly created using the IWsdlExportExtension interface.

I don't think someone already done this?
Does anyone perhaps has some other suggestions?

I understand this post might be difficult without context :)

May 4, 2011 at 10:48 AM

Basically you're creating a viewmodel from an Orchard content item and exposing that as a service, sounds reasonable.

May 5, 2011 at 3:24 PM

I even managed to mark a contentitem and some orchard classes as DataContract and exposed it's metadata using svcutil, but then on the client it isn't clean. The client code could use the contentitem.ContentItem.ContentManager etc.. it wouldn't even work since it needs to call the Record which could be lazy loaded etc etc..

The only solution i think is generating (since we generate it all anyway) a DataContract viewmodel foreach part that need's to be a knowntype on the client. And a DataContract as a ContentItem having the Parts as DataMembers. Just some simple mapping is needed..