Which code segment should you use to implement the service?

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.
You write the following code segment.
[ServiceContract(SessionMode=SessionMode.Required)]
public interface IOrderManager
{
[OperationContract]
void UpdateOrder(int orderId);
[OperationContract]
void ProcessOrder(int orderId);
}
You need to ensure that the service commits the transaction only when the session is closed.
Which code segment should you use to implement the service?

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.
You write the following code segment.
[ServiceContract(SessionMode=SessionMode.Required)]
public interface IOrderManager
{
[OperationContract]
void UpdateOrder(int orderId);
[OperationContract]
void ProcessOrder(int orderId);
}
You need to ensure that the service commits the transaction only when the session is closed.
Which code segment should you use to implement the service?

A.
[ServiceBehavior(ReleaseServiceInstanceOnTransactionComplete=true)]
public class OrderImpl : IOrderManager
{
[OperationBehavior(TransactionScopeRequired=true,
TransactionAutoComplete=true)]
public void UpdateOrder(int orderId) { }
[OperationBehavior(TransactionScopeRequired=true,
TransactionAutoComplete=true)]
public void ProcessOrder(int orderId) { }
}

B.
[ServiceBehavior(ReleaseServiceInstanceOnTransactionComplete=true)]
public class OrderImpl : IOrderManager
{
[OperationBehavior(TransactionScopeRequired=true,
TransactionAutoComplete=false)]
public void UpdateOrder(int orderId) { }
[OperationBehavior(TransactionScopeRequired=true,
TransactionAutoComplete=false)]
public void ProcessOrder(int orderId) { }
}

C.
[ServiceBehavior(TransactionAutoCompleteOnSessionClose=true)]
public class OrderImpl : IOrderManager
{
[OperationBehavior(TransactionScopeRequired=true,
TransactionAutoComplete=true)]
public void UpdateOrder(int orderId) { }
[OperationBehavior(TransactionScopeRequired=true,
TransactionAutoComplete=true)]
public void ProcessOrder(int orderId) { }
}

D.
[ServiceBehavior(TransactionAutoCompleteOnSessionClose=true)]
public class OrderImpl : IOrderManager
{
[OperationBehavior(TransactionScopeRequired=true,
TransactionAutoComplete=false)]
public void UpdateOrder(int orderId) { }
[OperationBehavior(TransactionScopeRequired=true,
TransactionAutoComplete=false)]
public void ProcessOrder(int orderId) { }
}



Leave a Reply 0

Your email address will not be published. Required fields are marked *