这是我的客户课程
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
}
}
IClient
在哪里Callback
。我正在使用netTcp
绑定。在将此对象传递给服务器方法时,我收到这样的错误,
尝试序列化参数http://tempuri.org/:observer时出错。InnerException 消息是 'Type 'Main.Communication.ClientClass',数据合同名称为 'CommunicationClient:http://schemas.datacontract.org/2004/07/Main.Communication.ClientClass' 不是预期的。将任何静态未知的类型添加到已知类型列表中 - 例如,通过使用 KnownTypeAttribute 属性或将它们添加到传递给 DataContractSerializer 的已知类型列表中。有关更多详细信息,请参阅 InnerException。