【发布时间】:2010-06-02 14:51:20
【问题描述】:
我有一个数据契约作为我的 WCF 接口的一部分,它继承自 IIdentity:
[DataContract]
public class AuthenticationIdentity : IIdentity
{
//implements IIdentity...
}
服务返回我的 AuthenticationIdentity 对象就好了。但是,当我尝试在客户端上做明显的演员时:
AuthenticationIdentity aId = client.GetID();
IIdentity id = aId;
我收到一条投诉,称 AuthenticationIdentity 无法转换为 IIdentity。我尝试将 ServiceKnownTypes 添加到界面:
[ServiceKnownType(typeof(AuthenticationIdentity))]
[ServiceKnownType(typeof(IIdentity))]
但仍然没有运气。有什么想法吗?
【问题讨论】:
标签: wcf interface datacontract