I had a WCF Service with an operation contract as
void AddQuery(IQuery Query);
My IQuery is like this
public interface IQuery
{
Guid Id { get; set; }
string QueryNo { get; set; }
string Status { get; set; }
IData data { get; set; }
}
and the implementation of IQuery is in
[Serializable]
public class Query : IQuery
{
Guid Id { get; set; }
string QueryNo { get; set; }
string Status { get; set; }
IData data { get; set; }
}
When i am trying to send my object from client as
public void AddQuery(IQuery query)
{
try
{
// I am sure that the query object is not null and it is implemented
objServiceClient.AddEnquiry(query);
}
catch (Exception ex)
{
}
}
But i am getting an exception as
There was an error while trying to serialize parameter . The InnerException message was 'Type 'ViewModels.Query' with data contract name 'Query:http://schemas.datacontract.org/2004/07/ViewModels' is not expected. Consider using a DataContractResolver or 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.
Could anyone suggest me what will be the resolution for this error?