找考题网-背景图
单项选择题

You are integrating a Windows Communication Foundation (WCF) service within an enterprise-wide Service Oriented Architecture (SOA).Your service has the following service contract:
[ServiceContract]public class CreditCardConfirmationService { [OperationContract] boolean ConfirmCreditCard(string ccNumber);
double OrderAmount(int orderNumber);}
You need to allow the code in the ConfirmCreditCard method to participate automatically in existing transactions.If there is no existing transaction, a new transaction must be created automatically. What should you do?()

A. Inside the ConfirmCreditCard method, surround the code that must participate in the transaction with a using(new TransactionScope()) block.
B. Inside the ConfirmCreditCard method, surround the code that must participate in the transaction with a using(new CommittableTransaction()) block.
C. Add an [OperationBehavior(TransactionScopeRequired=true)] attribute to the ConfirmCreditCard method.
D. Add an [OperationBehavior(TransactionAutoComplete=true)] attribute to the ConfirmCreditCard method.

热门试题

多项选择题A Windows Communication Foundation (WCF) solution uses the following contracts. (Line numbers are included for reference only.) 01 [ServiceContract(CallbackContract=typeof(INameService))] 02 public interface IGreetingService 03 { 04 [OperationContract] 05 string GetMessage(); 06 } 07 [ServiceContract] 08 public interface INameService 09 { 10 [OperationContract] 11 string GetName(); 12 } The code that implements the IGreetingService interface is as follows: 20 public class GreetingService : IGreetingService 21{ 22 public string GetMessage() 23 { 24 INameService clientChannel = OperationContext.Current.GetCallbackChannel(); 25 string clientName = clientChannel.GetName(); 26 return String.Format( Hello {0} , clientName); 27 } 28 } The service is self-hosted. The hosting code is as follows: 30 ServiceHost host = new ServiceHost(typeof(GreetingService)); 31 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None); 32 host.AddServiceEndpoint( MyApplication.IGreetingService , binding, net.tcp localhost:12345 ); 33 host.Open(); The code that implements the lNameService interface is as follows: 40 class NameService : INameService 41 { 42 string name; 43 public NameService(string name) 44 { 45 this.name = name; 46 } 47 public string GetName() 48 { 49 return name; 50 } 51 } Currently, this code fails at runtime, and an InvalidOperationException is thrown at line 25. You need to correct the code so that the call from the service back to the client completes successfully. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)()

A.
B.
C.
D.