Posts

Showing posts from 2014

WCF - Error Handling

Image
Regardless of what type of application we are creating, mistakes can always happen. The same goes for services and are not exempt from that. In the case of services, the errors can be as varied as possible, with problems in transport (protocol), delivery / receipt of the message at  runtime  or even (and most common) in the execution of the operation (method ). WCF provides several techniques to analyze and treat the possible errors that occur during the execution of the service. The challenge here is how to make this problem (error) is passed to the client that consumes regardless of platform, giving it the ability to know what happened and how to bypass it, keeping the client application and  proxy  stable. This article will address how we should proceed to throw errors, notify the customer and how it can do to handle errors that occur. .NET Framework is an error with a class that inherits directly or indirectly from the class  ...

WCF - Transactions

Image
An existing need in many applications is to ensure data consistency during handling. When performing a task, we need to ensure that if a problem occurs, the data back to its initial state. In computing this is guaranteed by the use of transactions. Transactions have been around for some time, and the purpose of this article is to show the alternatives we have to incorporate them into services and clients that make use of WCF as a means of communication. A classic example that demonstrates the need for transactions is when we need to create a routine transfer of money between two accounts. The transfer basically consists of two operations: withdraw money from an account and make a deposit into another. If a problem occurs between the withdrawal and the deposit and it is not wrapped in a transaction, the source account will without the money and the destination account does not receive the amount, making the data involved (balance of origin) is in an incons...