Bernie Cook's Blog

Azure, C#, .NET, Architecture & Related Tech News


Leave a comment

Distributed Design: Applying the Command Pattern to Azure’s Web/Worker Roles

WorkerRoleOne place I regularly come across the use of the Command pattern is when working on Azure projects that employ worker roles to execute long running tasks initiated by a scheduled process or user action. The Command pattern lends itself to the distributed nature of these solutions with very little plumbing required when working in Azure.

The following post provides a sample application; CommandQueue which contains 3 examples of a web and worker role utilising the Command pattern. The web role is designed to provide a rapid responses to the user, offloading any lengthy operations to the worker role. The source code for the CommandQueue solution is available on GitHub so feel free to clone, compile and execute it while working through this post.

Continue reading


Leave a comment

Put ReSharper In Your Toolbox

ReSharperReSharper, the productivity tool which extends the Visual Studio IDE, is one development tool that I would certainly not want to live without. It’s one thing to have a strong skill set and another to compliment it with a great set of tools.

I’d seen ReSharper in action a number of times back in early 2012 but was never sold on it – I mean Visual Studio is an amazingly rich IDE, how could you ever hope to make it better? Well JetBrains (the minds behind ReSharper) have done just that. ReSharper is designed as an extension to Visual Studio providing an array of productivity benefits for both teams and individual developers.

I’m conscious that by now I’m starting to sound like a salesman, but do bear with me. What I’ve done is bundle together a few ReSharper features in this post. Hopefully it’s enough of a introduction to convince you of it’s necessary place in your toolbox. Continue reading


5 Comments

Repository Caching with Aspect Oriented Programming

Repository Caching with Aspect Oriented ProgrammingThis post provides a walkthrough of how to implement basic cache handling at the repository layer using Aspect Oriented Programming (AOP). I’ve chosen PostSharp’s AOP framework and built a relatively simple Domain-Driven Design (DDD) solution in .NET to illustrate how it all ties together.

I want delve into too much AOP detail up front other than to reiterate the usual AOP pitch – that it’s an incredibly useful programming paradigm which addresses cross-cutting coding concerns within application development. What does that mean in English? Once you’ve mastered the basic AOP terminology and implementation requirements you can use it to remove a lot of duplicate code that appears throughout your solution. If you’re not familiar with AOP then take a quick moment to watch one of PostSharp’s many introductory screencasts or browse through their documentation. Keep in mind that AOP isn’t OOP as you work your way through the following code, it complements OOP extremely well but doesn’t follow object-oriented principles. Continue reading


Leave a comment

Free eBook: 50 Ways to Avoid, Find and Fix ASP.NET Performance Issues

50 Ways to Avoid, Find and Fix ASP.NET Performance IssuesRedgate just released a free ASP.NET eBook which contains 50 highly condensed, and highly practical, ASP.NET performance tips spanning a number of related topics; ORM, MVC, LINQ, SQL, async, string manipulation etc. Worth mentioning is that all of the tips came from developers in the .NET community.

The eBook can be downloaded in PDF format, and all it requires is your name, email and a number.

I’m a big fan of reading abbreviated “best of” tips on any framework in the Microsoft web stack and was quite impressed with the content and it’s presentation. I’d highly recommend this to any junior to intermediate-level ASP.NET developers.


4 Comments

Distributed Caching in Azure – Cache Worker Role

In June 2012 version 1.7 of the Windows Azure Platform release was introduced and with it came the new cache worker role. This provided another distributed cache management option for Azure developers alongside the likes of AppFabric Caching, or Memcached, to name a few. There are a number of ways to utilise and configure cache worker roles and this post covers one of them, providing a step by step guide to creating a new cloud solution where a web and worker role (cache clients) share the same cache worker role (cache cluster). Continue reading


Leave a comment

Book Review: “Professional ASP.NET MVC 4”

Professional ASP.NET MVC 4A few months after the official release of MVC 4 I decided to go hunting for an MVC 4 book that was less of an introduction to MVC 4 and written more for the seasoned MVC developer. I’d recently delivered an MVC 3 solution so was looking to work my way through a MVC 4 book that was (a) written by some respected authors, (b)  would provide a comprehensive guide to the latest iteration of this particular framework, (c) draw attention to those features new to version 4, and (d) provide a structure that easily permitted me to skim over the more familiar concepts.

So I did some research and ended up purchasing Wrox’s Professional ASP.NET MVC 4 by Jon Galloway, Phil Haack, Brad Wilson and K. Scott Allen. Having recently finished it I thought I’d share a review for the benefit of those who are in a similar situation to myself several months ago. Continue reading


1 Comment

Web API is the New WCF

Mads Kristensen is a Program Manager at Microsoft and during his Tech Days 2012 talk on “What’s new in ASP.NET 4.5 + Visual Studio 11” he made a statement that “Web API is, kind of, the new WCF” – it’s about an hour in if you want the exact spot. Putting the “kind of” part to the side for the moment, this is something of interest as two key questions I ask myself, out of many that I consider when designing a new Microsoft solution, are (1) have I identified the right technologies, i.e. MVC, SQL, Azure, etc. and (2) what type of commitment is Microsoft making to the technologies I’ve chosen. Continue reading