Hello,
I am having difficulty understanding how to exactly go about adding known types; for WCF, from a configuration file that is external to my wcf. I found an example of how to set the configuration file up, however, I am a bit confused as to the way the file is set up and I am not sure as to how I am actually supposed to call this configuration file to load the service known types to my wcf. Here is the example of the configuration file containing the known types.
http://codeidol.com/csharp/wcf/Data-Contracts/Data-Contract-Hierarchy/
I am confused about why you have to add the a type and then specify another type as a child of that type just added. It seems to me you would just add the type "Contact", specify its assembly; "Host" and that would be it. Why is it that a knownType element tag follows the add type element tag specifying another type? Also, once I have configuration file set up properly, when and how do I call it from my wcf? Any assistance would be appreciated. Thanks!
Update 1: **Ok this gives me a better understanding, Thanks. I did try what you said though, and the ServiceKnownTypes were not found. The only thing I did different in my App.config file is in my service and host is that I didn't have any knownType type = "..." to specify. Here is mine at a glance. Do you have an idea what I'm doing wrong?
<system.runtime.serialization>
<dataContractSerializer>
<declaredTypes>
<add type = "Data,TestService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=57f2af9570299a17"/>
</declaredTypes>
</dataContractSerializer>
</system.runtime.serialization>
Sorry about posting this to comment section earlier, I hope this is clearer.**
Update 2: Here is something closer to what I am trying to accomplish. What are your thoughts?
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/6b70e9f4-52bc-4fa9-a0ff-c0859e041e85?prof=required