Geeks With Blogs
Robin Hames Hints, tricks and tips relating to MS SQL Server and .NET C#
Adding SQL Cache Dependencies to the Loosely coupled .NET Cache Provider
This post adds SQL Cache Dependency support to the loosely coupled .NET Cache Provider that I described in the previous post ( The sample code is available on github at Each time we want to apply a cache dependency to a call to fetch or cache a data item we need to supply an instance of the relevant dependency implementation. This ......

Posted On Thursday, September 13, 2012 12:24 PM

Loosely coupled .NET Cache Provider using Dependency Injection
I have recently been reading the excellent book “Dependency Injection in .NET”, written by Mark Seemann, which I strongly recommend. Reading the ideas around Dependency Injection made me realise that the Cache Provider code I wrote about earlier (see could be refactored to use Dependency Injection, which should produce cleaner code. The goals are to: Separate the cache provider implementation ......

Posted On Tuesday, September 11, 2012 2:11 PM

Using JQuery Ajax method to pass Json to a MVC3 Action and return a partial view
ASP.NET MVC3 provides out of the box support for binding a Json data object into a Model on postback. This maybe used with a JQuery Ajax function call to post selected data back to an action. It is also possible to return a partial view from the same action, and refresh this from the ajax success function. For example: In my MVC3 Razor project, I create two model classes: public class NameResponseModel { public string Name { get; set; } public DateTime CurrentDateTime { get; set; } public IList<int> ......

Posted On Monday, August 6, 2012 10:23 PM

Data Caching Architecture: Using the ASP.NET Cache to cache data in a Model or Business Object layer, without a dependency on System.Web in the layer - Part Two. Adding Cache Dependency Support
Adding Cache Dependency Support This second part of my article on adding cache support to applications will extend the sample application developed in part one to add support for cache dependencies such as the SqlCacheDependency. Part One of this article is at: ICacheDependency Interface We will need to pass cache dependencies to the Cache Provider implementation, so the first step is to create ......

Posted On Wednesday, January 26, 2011 10:56 AM

Data Caching Architecture: Using the ASP.NET Cache to cache data in a Model or Business Object layer, without a dependency on System.Web in the layer - Part One.
ASP.NET applications can make use of the System.Web.Caching.Cache object to cache data and prevent repeated expensive calls to a database or other store. However, ideally an application should make use of caching at the point where data is retrieved from the database, which typically is inside a Business Objects or Model layer. One of the key features of using a UI pattern such as Model-View-Presenter (MVP) or Model-View-Controller (MVC) is that the Model and Presenter (or Controller) layers are ......

Posted On Monday, January 10, 2011 11:35 PM

Using int.TryParse() within a LINQ where clause
I pretty new to LINQ, and I’m keen to get more experience using it, so whenever an opportunity arises I like to try writing LINQ queries. I needed to write a method to extract a comma separated list of numbers from a config file, and return this as List<int>. I was looking at ways to do this using LINQ, but hit a problem. I wanted my LINQ query to filter out any values in the CSV string that could not be parsed as an int, without causing an exception. Using int.TryParse() seemed like a possible ......

Posted On Wednesday, August 12, 2009 10:37 AM

Copyright © Rhames | Powered by: