我有以下 wcf 服务:
[ServiceContract]
public interface IUnitTestingService
{
[OperationContract]
TestsResult ExecuteUnitTests(UploadRequest unitTestsExecutionData);
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
public class TestResult
{
public enum TestRunResult
{
Passed=1,
Failed=2,
Exception=3
}
public string TestName { get; set; }
public string StartTime { get; set; }
public string EndTime { get; set; }
public string Result { get; set; }
}
[MessageContract(WrapperName = "TestResult"), DataContract]
public class TestsResult
{
[MessageHeader, DataMember]
public List<TestResult> Results { get; set; }
[MessageHeader, DataMember]
public int TotalExecutedTests { get; set; }
[MessageHeader, DataMember]
public int TotalPassedTests { get; set; }
[MessageHeader]
public int TotalFailedTests { get; set; }
}
[MessageContract]
public class UploadRequest
{
[MessageHeader(MustUnderstand = true)]
public UnitTestingFrameworkType UnitTestingFrameworkType { get; set; }
[MessageBodyMember(Order = 1)]
public Stream Stream { get; set; }
}
但是,当我通过添加服务引用生成 wcf 客户端类时,我得到了这个:
public UTS.ServiceReference1.TestResult[] ExecuteUnitTests(UTS.ServiceReference1.UnitTestingFrameworkType UnitTestingFrameworkType, System.IO.Stream Stream, out int TotalExecutedTests, out int TotalFailedTests, out int TotalPassedTests)
而不是这个:
TestsResult ExecuteUnitTests(UploadRequest unitTestsExecutionData);
为什么?