WCF Service Contract issue...
Trying to create a very simple WCF service that can take in a Serializable object
and return a Serializable object. Here is the interface contract.
[
ServiceContract()]publicinterfaceISomeService{
[
OperationContract][
ServiceKnownType(typeof(System.Data.DataSet))]object Get(String Key);[
OperationContract][
ServiceKnownType(typeof(System.Data.DataSet))]void Set(String Key,object Object);[
OperationContract]void Remove(String Key);}
When I reference the contract in my client and call the Set method (passing a System.Data.DataSet object) I get:
There was an error while trying to serialize parameterhttp://tempuri.org/
bject. The InnerException message was 'Type 'System.Data.DataSet' with data contract name 'DataSet:http://schemas.datacontract.org/2004/07/System.Data' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.
Ultimately I want to pass more than just a DataSet object of course and had tried
adding the following to my config file for the client since doing it declaratively would
mean I'd have to recompile to define new objects:
<system.runtime.serialization>
<dataContractSerializer>
<declaredTypes>
<add type="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<knownType type="System.Data.DataSet, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</add>
</declaredTypes>
</dataContractSerializer>
</system.runtime.serialization>
But I got the following error:
The value for the property 'type' is not valid. The error is: The type System.Object
cannot be used as a declared type in config.
What can I do to achieve this...please Help!

