例如:我的服务合同
[ServiceContract]
public interface IProvider
{
[OperationContract]
DataSet CreateDataSetFromSQL(string command, params object[] par);
}
在参数之一是 Array/List/ArrayList 之前,一切都可以正常工作。我得到一个序列化异常:
data contract name 'ArrayOfanyType:http://schemas.microsoft.com/2003/10/Serialization/Arrays' 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.
正如我所提到的,当字符串数组作为参数之一时,我得到了同样的错误。
客户
private static ChannelFactory<IProvider> _channel;
private static IProvider _proxy;
private static DataTransferClient _client;
public DataSet CreateDataSetFromSQL(string commandCode, params object[] par)
{
return _proxy.CreateDataSetFromSQL(commandCode, par);
}
知道如何解决它吗?