次の 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);
なんで?