单项选择题
You are developing a Windows Communication Foundation (WCF) service to replace an existing ASMX Web service.The WCF service contains the following code segment. (Line numbers are included for reference only.)
01 [ServiceContract()]
02
03 public interface IEmployeeService
04 {
05 [OperationContract()]
06 EmployeeInfo GetEmployeeInfo(int employeeID);
07
08 }
09
10 public class EmployeeService : IEmployeeService
11 {
12
13 public EmployeeInfo GetEmployeeInfo(int employeeID)
14 {
15 ...
16 }
17 }
18
19
20 public class EmployeeInfo
21 {
22 ...
23 public int EmployeeID { get; set; }
24 public string FirstName { get; set; }
25 public string LastName { get; set; }
26
27 }The existing Web service returns the EmployeelD as an attribute of the Employeelnfo element in the response XML.You need to ensure that applications can consume the service without code changes in the client.
What should you do?()
A. Insert the following code at line 02. [DataContractFormat()] Insert the following code at line 22. [DataMember()]
B. Insert the following code at line 02. [XmlSerializerFormat()] Insert the following code at line 22. [XmlAtttibute()]
C. Insert the following code at line 09. [XmlSerializerFormat()] Insert the following code at line 22. [XmlAttribute()]
D. Insert the following code at line 19. [DataContractFormat()] Insert the following code at line 22. [DataMember()]
相关考题
-
单项选择题
You are developing a Windows Communication Foundation (WCF) service that contains the following service contract.[ServiceContract()]public interface IPaymentService{ [OperationContract()] void RecordPayments(Person person);}public class Person{ ... }public class Employee : Person{ ... }public class Customer : Person{ ... }You need to ensure that RecordPayments can correctly deserialize into an Employee or a Customer object. What should you do?()
A. Add the following KnownType attribute to the Employee class and to the Customer class. [KnownType(GetType(Person))]
B. Implement the IExtensibleDataObject interface in the Person class.
C. Implement the IExtension(ofType(T)) interface in the Person class.
D. Add the following KnownType attributes to the Person class. [KnownType(GetType(Employee))] [KnownType(GetType(Customer))] -
单项选择题
You are modifying a Windows Communication Foundation (WCF) service that allows customers to update financial data. The service currently requires a transaction from the client application and is working correctly. The service contract is defined as follows. (Line numbers are included for reference only.) 01 [ServiceContract()] 02 public interface IDataUpdate 03 { 04 [OperationContract()] 05 [TransactionFlow(TransactionFlowOption.Mandatory)] 06 void Update(string accountNumber, double amount); 07 08 } 09 10 public class UpdateService : IDataUpdate 11 { 12 13 [OperationBehavior(TransactionScopeRequired=true, TransactionAutoComplete=true)] 14 public void Update(string accountNumber, double amount) 15 { 16 try 17 { 18 ... 19 } 20 catch(Exception ex) 21 { 22 ... 23 } 24 } 25 }The service must be modified so that client applications do not need to initiate a transaction when calling the operation. The service must use the client application’s transaction if one is available. Otherwise it must use its own transaction.You need to ensure that the service operation is always executed within a transaction. What should you do?()
A. Replace line 05 with the following code. [TransactionFlow(TransactionFlowOption.NotAllowed)]
B. Replace line 13 with the following code. [OperationBehavior(TransactionScopeRequired=false, TransactionAutoComplete=true)]
C. Replace line 05 with the following code. [TransactionFlow(TransactionFlowOption.Allowed)]
D. Replace line 13 with the following code. [OperationBehavior(TransactionScopeRequired=false, TransactionAutoComplete=false)] -
单项选择题
You are developing a Windows Communication Foundation (WCF) service. The service configuration file has a element defined. You need to ensure that all security audit information, trace logging, and message logging failures are recorded. Which configuration segment should you add to the element?()
A.
B.
C.
D.
