This is my Client class
using System;
using System.Data;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace Main.Communication
{
public delegate void EventReceivedEventHandler(DataSet InBoxNotifications, bool updateOutBoxFlag);
public delegate void OpenConnectEventHandler(int spaceId, string accessionNumber, string modality, long assignedCaseId, long originalCaseId);
[DataContract]
public class ClientClass : IClient, IDisposable
{
public event EventReceivedEventHandler EventReceived;
public event OpenConnectEventHandler OpenConnectSystem;
public ClientClass(int userId)
{
this.UserId = userId;
this.Authentication = Guid.NewGuid().ToString();
}
private string _authentication;
[DataMember]
public string Authentication
{
get { return _authentication; }
set { _authentication = value; }
}
private int _userId;
[DataMember]
public int UserId
{
set { _userId = value; }
get { return _userId; }
}
#region "IClient Members"
public bool UpdateInDataBox(DataSet InBoxNotifications, bool updateOutBoxFlag)
{
if (EventReceived != null) EventReceived(InBoxNotifications, updateOutBoxFlag);
return true;
}
public void OpenReviewPanel(int spaceId, string accessionNumber, string modality, long assignedCaseId, long originalCaseId)
{
if (OpenConnectSystem != null) OpenConnectSystem(spaceId, accessionNumber, modality, assignedCaseId, originalCaseId);
}
#endregion
#region IDisposable Members
public void Dispose()
{
((ICommunicationObject)this).Abort();
}
#endregion
}
}
Where IClient
is the Callback
. I am using netTcp
binding. While Passing this object to the Server method, I am getting a error like this,
There was an error while trying to serialize parameter http://tempuri.org/:observer. The InnerException message was 'Type 'Main.Communication.ClientClass' with data contract name 'CommunicationClient:http://schemas.datacontract.org/2004/07/Main.Communication.ClientClass' 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.