PrepAway - Latest Free Exam Questions & Answers

Which code segments should you include in Target 1, Tar…

DRAG DROP
You are developing a WCF service application.
The application must meet the following requirements.
Operations must have 30 seconds timeouts.
The service must have a transaction scope.
Transactions must flow from the client to the server.
You need to write a transactional service contract and implementation class to meet the requirements.
You have the following code:

Which code segments should you include in Target 1, Target 2, Target 3, and Target 4 to complete the code?
(To answer, drag the appropriate code segments to the correct targets in the answer area. Each code segment
may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to
view content.)
Select and Place:

PrepAway - Latest Free Exam Questions & Answers

Answer:

Explanation:
Box 1: [ServiceContract]
Each interface must have the ServiceContractAttribute applied toit and each operation must have the
OperationContractAttribute attribute applied to it. If a method within an interface that has the
ServiceContractAttribute attribute does not have the OperationContractAttribute attribute, that method is not
exposed by the service.
Note: When using attributes to annotate an interface, member, or class, you can drop the “Attribute” part from
the attribute name. So ServiceContractAttribute becomes
[ServiceContract] in C#.
Box 2: [TransactionFlow(TransactionFlowOption.Mandatory.
The service must have a transaction scope.
Transactions must flow from the client to the server.
Note: The TransactionFlow attribute specifies whether the operation supports transactions. There are three
possible values for this attribute:
*Mandatory : In order to call this operation, the client must create a transaction.
* NotAllowed : The operation cannot participate in a transaction. This is the default value for this attribute.
* Allowed : The operation will participate in a transaction if the client creates one.
Box 3: [ServiceBehavior(TransactionTimeout = “00:00:30”)]
Define the ServiceBehavior for the interface. Use “00:00:30”, not 30, to define that operations must have 30
seconds timeouts.
Box 4: [OperationsBehaviour(TransactionScopeRequired=True)
We must decorate the Foo method with TransactionScopeRequired attribute.
The correct syntax is [OperationsBehaviour(TransactionScopeRequired=True), not
[OperationsBehaviour.required]References: https://msdn.microsoft.com/en-us/library/ms731835(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/ff384250.aspx


Leave a Reply