0
我構建了一個概念證明WCF服務,並且有意構建出所有接口以避免在必要時提供任何具體實現。我想將結果合同(包括消息定義)發送給另一個團隊,以開始構建我正在構建的合同,但消息參數未被序列化,除非我提供用DataContractAttribute裝飾的類。有沒有辦法讓我繼續使用鬆散耦合的接口來定義我的合同,還是需要使用類來構建我的所有消息?WCF定義WSDL中的接口契約
示例服務
[ServiceContract]
public interface ITestService
{
[OperationContract]
ITestResponse TestOperation(ITestRequest request);
}
public interface ITestRequest
{
string Message { get; set; }
}
public interface ITestResponse
{
bool Success { get; set; }
}
例XSD定義
<xs:element name="TestOperation">
<xs:complexType>
<xs:sequence>
<!--I want this to be a reference to a complex type with definition of it's members-->
<xs:element minOccurs="0" name="result" nillable="true" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>