Contents tagged with .net

  • My Windows Services Panel

    As a developer I have a lot of different types of Windows Services installed on my computer for the different projects I work on. Services like MS SQL Server Express, MS SQL Server, IIS, MSMQ and MySQl.

    I don't use all of them all of the time, but I would normally leave them running because I couldn't be bothered trawling through all of the services in Services Manager to stop and start them. Having them running all the time made my computer take longer to startup and I felt like it was slowing it down generally and stealing battery power.

    So I created My Windows Services Panel as a way to … more

    Tags: .net

    No Comments
  • NHibernate Search String Dictionary Bridge

    NHibernate Search is an extension to NHibernate that uses Lucene to give you full text search using Lucene under the hood. It also makes using Lucene in your .NET app easier than using Lucene.NET directly.

    Lucene only indexes text on a document in a flat key-value structure. Bridges are used to turn properties on your indexed documents into text.

    NHibernate Search comes with bridges for common types such as enum, but you can also write your own. This is an example of a bridge that turns a Dictionary property on your indexed objects into a set of properties on the lucene document. It only … more

  • Sharing Resource Dictionaries in your Xamarin.Forms App

    The Xamarin.Forms Application base class has a Resources property that you can use to share a resource dictionary accross all pages of your app. If your app was created before Xamarin.Forms 1.4 you'll need to make sure you update and make your main App class inherit from the new Application class.

    If you like to do everything in code rather than XAML then you can create a ResourceDictionary in the constructor of you App class:

    public class App : Application


    public App()


    Resources = new ResourceDictionary();

    Resources.Add("ForegroundThemeColor", … more

  • Xamarin Forms at NDC London 2014

    If you're interested in finding out more about Xamarin Forms you may find the following interesting:

    Free eBook: Creating Mobile Apps with Xamarin.Forms by Charles Petzold (Preview edition)

    Video: Creating your first Xamarin.Forms App (Xamarin Evolve 2014)

    Video: Xamarin.Forms is Even Cooler Than You Think (Xamarin Evolve 2014)

    Video: XAML for Xamarin.Forms (Xamarin Evolve 2014)

    Video: Extending Xamarin.Forms with Custom Controls (Xamarin Evolve 2014)


  • Advent Calendar for Windows 8

    As a fun Christmasy project I've made a simple Advent Calendar for Windows 8. It comes with awesome illustrations from my good friend Hexjibber and is the prefect way to count down the days till Christmas.

    Get this awesome Advent Calender now from the Windows Store.

    Enjoy and have a happy Christmas! more

    Tags: .net

    No Comments
  • Dizzy Dalek at NDC 2014

    The video of my talk on MonoGame and 3D (featuring a dizzy dalek) is now live on Vimeo:

    You can find the demo code here:

    Other NDC Game Development Related talks

    If you enjoyed this talk, you may also enjoy:

    Cross-platform physics-based gaming using MonoGame and Farseer

    Game and Simulator Physics for Developers, Gamers and Petrol Heads

    Porting Quake III to F#: A Journey to Functional Programming


  • Using extension methods to filter IQueryable data collections

    As I talked about in my post Do we need the repository pattern? I’ve been thinking about how we can make a testable data access layer with Entity Framework without using a repository pattern. I showed how you could do that in my post Mocking your Entity Framework data context and testing it in .NET MVC. However losing the repository also loses a nice centralised place to keep your query logic. In this post I’ll show you a nice simple way to use extension methods to do this.

    Suppose you’re using Entity Framework to store a collection of foos and there are several places in … more

  • Mocking your Entity Framework data context and testing it in .NET MVC

    I explained in my previous post Do we need the repository pattern? why you might want to mock your Entity Framework context rather than using the repository pattern. In this post I'll show you how to do that and how to test your .NET MVC controllers with a fake data context.

    The way you do this varies slightly depending on whether you're using code first or database first. I'll cover both in this post.

    Using Code First in Entity Framework 4

    My implementation of code first is based heavily on the blog post by Rowan Miller.

    A mockable data context (EF Code First)

    When you create your … more

  • Do we need the repository pattern?

    As we learn new technologies, we discover new mistakes. The Entity Framework makes data access very quick to develop, but also introduces a new set of mistakes that can be made. On my last project I used the Entity Framework Profiler and found my code blighted with a scourge of N+1 problems. I discussed this in my blog post Reviewing my data access layer using the Entity Framework Profiler.

    I was also worried that my code wasn’t testable. From what I’d read, the repository pattern seemed to be the agreed best practice for making your data access testable.

    However my N+1 problems … more

  • A .NET MVC Helper to create HTML wrapping elements

    In HTML when you want to create a box around some content with rounded corners or some other nice feature it would be nice if you could just wrap that content in a <div> or a <section> tag and CSS would do the rest. However this rarely seems to be the case, particularly if you want the HTML to render well in older browsers. The views in my latest .NET MVC 3 project were full of repeated opening and closing sections of HTML for something that we called a chunk, which is just our word for a box with rounded corners that groups together related elements on the page. Sometimes a chunk … more