0
這裏是我的WCF雙工服務的回調接口:雙工服務引用轉換接口類型爲System.Object的類型
public interface ICallback
{
[OperationContract(IsOneWay = true)]
void SendClientCallback(CallbackMessage callbackMessage);
[OperationContract]
void GetTemplateList(ref List<ISpecimenTemplateDescriptor> templateDescriptors, IDrawerLayout drawerLayout);
}
我配置我的服務參考使用System.Collections.Generic.List類型。我通過右鍵單擊服務引用,選擇配置服務選項並更改集合類型來完成此操作。這將服務引用配置爲使用List的集合類型,而不是默認的Array類型。
當我編譯和更新我的服務參考,我的接口類型「ISpecimenTemplateDescriptor」和「IDrawerLayout」被轉換成「System.Object的」,如下所示:
void GetTemplateList(ref System.Collections.Generic.List<object> templateDescriptors, object drawerLayout);
爲什麼我的接口對象轉換爲系統.Object在服務引用中?
這裏是我的服務合同:
[ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(ICallback))]
public interface IWcfService
{
.....
}
這裏是我的服務行爲:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Reentrant, UseSynchronizationContext = false)]
public class WcfService : IWcfService
{
......
}
感謝您的幫助提前!