Posts Tagged: c-sharp

Sitecore and WebApi Living in Harmony

We all seem to love WebApi. On the Microsoft technology stack, it is probably the most well-conceived method of building a REST-like web service. If you are building a Sitecore website, though, you may have a problem. Sitecore takes over most of the ASP.NET request cycle, which poses a problem for other ASP.NET technologies, including… Read more »

Object Cesspool Anti-Pattern

Object pools are a common pattern in development. The canonical example is probably a database connection pool. If objects returning to the pool are not validated, the pool can gradually fill with garbage objects, turning it into a cesspool of unusable objects. How to Identify The two easiest ways to identify if your object pool… Read more »

Order of Operations in nested try..catch..finally

Let’s dive in and take a look at some common and not-so-common exception handling arrangements. Everyone should be familiar with the standard try..catch..finally construct: try { //this code will run only until an exception is thrown } catch { //this code will run only IF and exception is thrown } finally { //this code will… Read more »

Exceptional Introduction

There has been a lot of discussion over the years about when and how to use exception throwing and handling. The general consensusĀ seems to shift every once in a while. The performance of exceptions is not the primary purpose of this article, but I felt the need to discuss it in order to truly address… Read more »