WCF Interview Questions:
- What is a SOA and how WCF supports it?
- What is two phase committed protocol?
- What is the role of transaction manager in WCF?
- What is transaction propagation and how WCF supports it?
- What are the supported transaction type in WCF?
- What are the different transaction flow options supported by WCF?
- What all are the WCF binding supports transaction propagation?
1.What is a SOA and how WCF supports it?
A loosely-coupled architecture designed to meet the business needs of the organization.
Service-Oriented Architecture (SOA) is an architectural style that supports service-orientation. Service-orientation is a way of thinking in terms of services and service-based development and the outcomes of services.
These services are well defined, self-contained and can work together to achieve certain business functionality without depending on context or state of other services.
WCF supports almost all principles by Service Oriented Architecture for developing services; those are independent, loosely coupled and interoperable also
You can read more on SOA here.
2.What is two phase committed protocol?
The two phase commit protocol is a distributed algorithm which lets all sites in a distributed system agree to commit a transaction.
The protocol results in either all nodes committing the transaction or aborting, even in the case of site failures and message losses.
- Prepare Phase
- Commit phase
3.What is the role of transaction manager in WCF?
Transaction manager initiates the transaction and coordinates with all the processes that participate in a distributed transaction to commit or roll back.
4.What is transaction Propagation and how WCF supports it?
Transaction propagation is the ability to propagate transaction across the boundaries of a single service.
In a SOA environment, transaction propagation becomes a key requirement. As we know that WCF supports SOA, so it provides support for transaction propagation as well.
WSHttpBinding bindingBeingUsed = new WSHttpBinding();
bindingBeingUsed.TransactionFlow = “true”;
Or It can be done declaratively by updating configuration file as follows:
<binding name=”binding1” transactionFlow=”true” />
To enable transaction propagation, we need to set the value of TransactionFlow property of the binding being used. This can be done programmatically as follows:
5.What are the supported transaction types in WCF?
There are three different kinds of transaction protocols used by WCF.
- WS Atomic Transaction
6. What are the different transaction flow options supported by WCF?
There are 3 transaction flow options are supported by WCF.
- NotAllowed Transaction Propagation is not allowed for particular service method. Its default value.
- Allowed Transaction Propagation is allowed but not compulsory.
- Mandatory Transaction Propagation is compulsory for that service method.
Reference books, you may like:Programming WCF Services: Design and Build Maintainable Service-Oriented Systems
WCF Multi-Layer Services Development with Entity Framework, 4th Edition
Learning WCF: A Hands-on Guide
7. What all are the WCF binding supports transaction propagation?
Not all WCF bindings support transaction propagation. Only following list of bindings support for it.
© 2015, admin. All rights reserved.