Generic Dictionary

Topics: General Discussion Forum, Service Factory Modeling Edition Forum
Aug 26, 2008 at 8:39 PM
It seems like a simple enough of task, but for the life of me I can't figure out how to do this:

I have a service operation that takes in a dictionary.  Currently, I have 2 things:

1) a primitive data type collection called "Dictionary" as a data contract
2) the service operation request with a data contract message part of type Dictionary

Now, this just seems like a very cumbersome way to use the Systems.Collections.Generic.Dictionary since the "Dictionary" data contract really just inherits from the generic dictionary.

But, I can't find any way of just specifying a new message part of type generic dictionary.  I've resorted to creating a partial class of the message contract and manually defining the generic dictionary field.  Is this the only way?

Thanks.
Aug 27, 2008 at 9:14 PM
Hi lgloria, you are correct, message parts can only be set using primitive types or data contracts. In your case I see no reason for not to use a data contract message part but still the approach you mention seems possible, you can find another workaround in the following post: http://www.codeplex.com/servicefactory/Thread/View.aspx?ThreadId=23616 .

Thanks