Category Archives: Databases

Follow-up: a happy ending to the Visual Studio story – Microsoft team steps in to help

A couple of days ago I published a long post documenting the challenging experience I’d had trying to buy a new Visual Studio cloud subscription:

My sorry tale of trying and failing to buy a Visual Studio cloud subscription

Well, I’m happy to report that, after the efforts of a number of awesome people at Microsoft, I’ve managed to successfully activate my Visual Studio subscription and I’m now up and running again with both Windows 10, Visual Studio and (shortly) SQL Server installed and functioning correctly.

So, this time around, let me tell a happier tale…

It starts when, having seen my plight, John Montgomery got in touch via twitter, looping in Buck Hodges:

John Montgomery and Buck Hodges of Microsoft see my plight on twitter and kindly reach out.

These two are both heavy hitters in Visual Studio and .NET in Redmond. John is Partner Director of Program Management, and Buck Hodges is a Partner Director Software Engineer. Having these guys on the case is already reassuring.

Buck’s initial suggestion didn’t quite work out but after getting back in touch with them he asked me to drop him an email so he could expedite the process. Things then started happening quite quickly.

Buck immediately looped in Andrew Brenner, Mike Tayebi, and Marc Paine to help. Marc is a Principal Software Engineer Manager, and Andrew is a Senior Program Manager.

Marc and Andrew got to work on finding a fix and, later in the evening, Marc emailed me instructions with a workaround they’d come up with. Due to timezone differences, and meetings the following morning, I couldn’t immediately try it out. As soon as I could I gave it a try and was overjoyed to be find that I was now able to assign the subscription to myself via in a private browsing session:

I can now see and assign my Visual Studio Professional subscription to myself

I’m not quite home and dry yet but this, in itself, is serious progress. A few minutes later I received the following welcome email to activate my subscription:

Yes! Welcome email from Microsoft at last.

I click the Activate my subscription button (actually I copy the link into another private browsing session) and I’m able to successfully activate my subscription.

Now, when I log in to I’m can access all my benefits:

Visual Studio subscription downloads.

Visual Studio subscription product keys.

(I’m loving the fact there’s an entry in there for Office 95 Professional, btw.)

I’m able to download and install both Windows 10 and Visual Studio 2015:

Success! BOOM!

Success! BOOM! That’s both of the above installed and running in a Parallels VM. I’m extremely happy. I’m also extremely impressed with the speed of the Windows 10 install – I didn’t time it, but it really was only a few minutes. Very cool.

Marc also tells me that they’ve figured out why I couldn’t see or manage any subscriptions and are discussing a solution so that in future the workaround won’t be necessary, as well as investigating some other failure points I identified. Andrew also spent time going through my previous post creating a list of issues that various teams need to address to avoid other people having a similar experience.

Honestly, I’m so impressed with the way these guys stepped up and helped out. I’d particularly like to thank John, Buck, Marc, and Andrew for all their work and time in getting me unblocked, and for taking ownership over the process.

This is absolutely consistent with my previous experience dealing with people who work for Microsoft. Once you find an in to the right person or group of people, past the seemingly impenetrable corporate exterior, what you find are smart people who really care about what they do and about delivering a great experience to customers, and who will go above and beyond to do that. I know they’re going to find and implement solutions for all the problems I had.

I’d also like to thank the UK licensing support team who, whilst they weren’t equipped to handle these kinds of problems, did try and help out as much as they could, as well as Jeff Lambert (Escalation Engineer), and Trevor Hancock (Senior Escalation Engineer), who got in touch to try and help, and followed up to see how I was getting on.

Lastly, I’d like to thank my friend Elisabeth Blees, who is a Program Manager in the Visual Studio team, and who checked in to see how I was getting on, followed up with Buck and his team, and updated me on what they’d been doing.

So I’m pleased to say I’m up and running, and help from Buck and his team really couldn’t have come at a better time: I’m giving a talk on performance tuning .NET and SQL Server web apps at tomorrow’s DDD event at Microsoft’s UK headquarters in Reading, and now I have everything I need to do that.

Thanks again to all!

Current talk list 2016: web and database performance

It’s that time of the year where, for me, talk proposals are submitted. I also tend to take it as an opportunity to refresh and rework talks.

This year I’ve submitted talks for DDD, DDD North, and NDC London (this one’s a bit of a long shot), and am keeping my eye out for other opportunities. I’ll also be giving talks at the Derbyshire .NET User Group, and DDD Nights in Cambridge in the autumn.

Voting for both DDD and DDD North is now open so, if you’re interested in any of the talks I’ve listed below, please do vote for them at the following links:

Here are my talks. If you’d like me to give any of them at a user group, meetup, or conference you run, please do get in touch.

Talk Title: How to speed up .NET and SQL Server web apps

Performance is a critical aspect of modern web applications. Recent developments in hardware, software, infrastructure, bandwidth, and connectivity have raised expectations about how the web should perform.

Increasingly this attitude is applied to internal line of business apps, and niche sites, as much as to large public-facing sites. Google even bases your search ranking in part on how well your site performs. Being slow is no longer an option.

Unfortunately, problems can occur at all layers and in all components of an application: database, back-end code, systems integrations, local and third party services, infrastructure, and even – increasingly – the client.

Complex apps often have problems in multiple areas. How do you go about tracking them down and fixing them? Where do you begin?

The answer is you deploy the right tools and techniques. The good news is that generally you can do this without changing your development process. Using a number of case studies I’m going to show you how to track down and fix performance issues. We’ll talk about the tools I used to find them, and the fixes that resulted.

That being said, prevention is better than cure, so I’ll also talk about how you can go about catching problems before they make it to production, and monitor to get earlier notification of trouble brewing.

By the end you should have a plethora of tools and techniques at your disposal that you can use in any performance analysis situation that might confront you.

Talk Title: Premature promotion produces poor performance: memory management in the CLR and JavaScript runtimes

The CLR, JVM, and well-known JavaScript runtimes provide automatic memory management with garbage collection. Developers are encouraged to write their code and forget about memory management entirely. But whilst ignorance is bliss, it can also lead to a host of problems further down the line.

With web applications becoming ever more interactive, and the meteoric rise in popularity of mobile browsers, the kind of performance and resource usage issues that once only concerned back-end developers have now become common currency on the client as well.

In this session we’ll look at how these runtimes manage memory and how you can get the best out of them. We’ll discuss the “classic” blunders that can trip you up, and how you can avoid them. We’ll also look at the tools that can help you if and when you do run into trouble, both on the client and the server.

You should come away from this session with a good understanding of managed memory, particularly as it relates to the CLR and JavaScript, and how you can write code that works with the runtimes rather than against them.

Talk Title: Optimizing client-side performance in interactive web applications

Web applications are becoming increasingly interactive. As a result, more code is shifting to the client, and JavaScript performance has become a key factor for many web applications, both on desktop and mobile. Just look at this still ongoing discussion kicked off by Jeff Atwood’s “The State of JavaScript on Android in 2015 is… poor” post:

Devices nowadays offer a wide variety of form factors and capabilities. On top of this, connectivity – whilst widely available across many markets – varies considerably in quality and speed. This presents a huge challenge to anyone who wants to offer a great user experience across the board, along with a need to carefully consider what actually constitutes “the board”.

In this session I’m going to show you how to optimize the client experience. We’ll take an in depth look at Chrome Dev Tools, and how the suite of debugging, data collection and diagnostic tools it provides can help you diagnose and fix performance issues on the desktop and Android mobile devices. We’ll also take a look at using Safari to analyse and debug web applications running on iOS.

Throughout I’ll use examples from to illustrate. is an HTML5, JavaScript, and CSS games site. Currently it hosts a version of Star Castle, called Star Citadel, but I’m also working on versions of Asteroids (Space Rawks!), and Space Invaders (yet to find an even close to decent name). It supports both desktop and mobile play. Whilst this site hosts games the topics I cover will be relevant for any web app featuring a high level of interactivity on the client.

Talk Title: Complex objects and microORMs: an introduction to the Dapper.SimpleLoad and Dapper.SimpleSave extensions for StackExchange’s Dapper microORM

Dapper ( is a popular microORM for the .NET framework that provides simple way to map database rows to objects. It’s a great alternative when speed is of the essence, and when you just don’t need the functionality offered by EF.

But what happens when you want to do something a bit more complicated? What happens if you want to join across multiple tables into a hierarchy composed of different types of object? Well,then you can use Dapper’s multi-mapping functionality… but that can quickly turn into an awful lot of code to maintain, especially if you make heavy use of Dapper.

Step in Dapper.SimpleLoad (, which handles the multi-mapping code for you and, if you want it to, the SQL generation as well.

So far so good, but what happens when you want to save your objects back to the database?

With Dapper it’s pretty easy to write an INSERT, UPDATE, or DELETE statement and pass in your object as the parameter source. But if you’ve got a complex object this, again, can quickly turn into a lot of code.

Step in Dapper.SimpleSave (, which you can use to save changes to complex objects without the need to worry about saving each object individually. And, again, you don’t need to write any SQL.

I’ll give you a good overview of both Dapper.SimpleLoad and Dapper.SimpleSave, with a liberal serving of examples. I’ll also explain their benefits and drawbacks, and when you might consider using them in preference to more heavyweight options, such as EF.

Discovered a new tool for working with MongoDB: MongoChef from 3T Software Labs

I thought this was worth sharing. A former colleague of mine from Red Gate put me in touch with an awesome company called 3T Software Labs, who have a suite of tools for working with MongoDB, including a great shell for MongoDB called MongoChef. I was fortunate enough to be able to spend some time this afternoon running through a usability test on MongoChef with one of 3T’s co-founders, Thomas Zahn.

Up until now I’ve used both RoboMongo and MongoVUE for this kind of work, both of which have their strengths and weaknesses, and inevitably I’ve ended up using them both for different purposes.

MongoChef seems to offer the best of both whilst also being more capable and is being rapidly developed on a very short release cycle so the improvements seem to be coming thick and fast, so I suspect it’ll replace them both from now on.

Anyway, I really just wanted to run through some of the functionality very quickly…

First off, download and install MongoChef. If you want to use the integrated shell, make sure you’ve also got the MongoDB binaries installed.

Connecting to a MongoDB instance is dead simple. Just click the big green Connect button on the welcome screen, or use the corresponding toolbar button:

MongoChef welcome screen Connect button

This opens up the Connection Manager:

MongoChef Connection Manager dialog

Now click New Connection, and give your connection a name. The really nice thing is that it’s easy to populate this dialog from a URI, for example, one that you use in your web.config, using the From URL button:

Creating a new MongoDB connection in MongoChef

Just paste in your URI, click OK, and you’re good to go:

Populating the New Connection dialog from a URI

Likewise, if you need a URI as a connection string, you can grab that using the To URI button:

Exporting a URI from connection settings in MongoChef's New Connection dialog

Just double-click on any connection in the Connection Manager to connect to that instance.

Active connections are shown in the treeview on the left of the main window. You can drill in to view databases and connections:

Treeview showing active MongoDB connections

You can double-click on a collection to open it. Pagination is customisable and you can drill into documents:

MongoChef's collection view

There are also three different views for documents: Tree View, Table View, and JSON View.

Different view styles for MongoChef's collection view

My favourites are definitely Tree View and JSON View. Table View works particularly well for very flat documents.

Tree View works best with the Query Builder, which is a handy way to quickly throw together queries without having to scratch your head over the syntax. It’s particularly helpful if, like me, you’re from a SQL background, so tend to know what data you want back (and how you’d like it structured), but struggle a little to express that in JavaScript rather than SQL.

To use the Query Builder just hit the corresponding button in the top-right of the collection view:

Click the button to open the Query Builder

To build your query, just:

  • drag the fields you want to query against into the Query section, and set the query criteria for each field
  • drag the fields you’d like to sort by into the Sort section,
  • the fields you’d like returned into the Projection* section.

*A projection defines the subset or shape of data you’d like to receive back from MongoDB. It’s analagous to the column list after SELECT in a SQL query.

Then, to run your query, just click the Run button. Here’s an example:

Using the Query Builder

The one thing missing here is a script view that would display the JavaScript for the query, which would be a handy teaching tool, but Thomas assures me this is coming – they’re working on it right now in fact.

Editing documents is just as easy as querying. Just double-click on the value you want to edit and type in something else. This even works with projections:

Editing a document in the collection view

If you prefer to get a bit lower level and want to bash out queries directly in JavaScript you can access the integrated shell via the Shell toolbar button:

Use the Shell toolbar button to open the integrated shell

Enter your query in the pane at the bottom of Shell, which includes intellisense/autocomplete to help you, which is absolutely invaluable. If it takes to long to appear just use the standard CTRL+SPACE shortcut to force it:

Editing a query in MongoChef's integrated shell with intellisense/autocomplete

You can hit ENTER to execute your query. Results appear in the pane at the top of the Shell.

Query results in the integrated shell

If this isn’t the behaviour you want just uncheck Enter Executes.

If you’ve ever installed MongoDB from scratch you’ll know that setting up users can be a royal pain in the backside. Fortunately MongoChef provides help with user management too.

Just select the database you want and click Users on the toolbar:

Accessing the user management view in MongoChef

You can drill into each user to see which roles they have. Click Add to add a new user:

MongoChef's user management view

Assign a username and password to your new user. If you want them to be able to do anything, you’ll also need to assign one or more roles to them. Click Grant Roles to do this:

Adding a user in MongoChef

To assign a single role, just double-click on it. To assign multiple roles, use CTRL+Click to multi-select, then click Grant:

Assigning roles to a user

Back in the Add User dialog box just click the Add User button, and you’re done.

This is by no means a comprehensive look at all the features available in MongoChef, but hopefully it’s given you a flavour of what the tool can do. I’d strongly recommend you try it yourself though, so here’s that download link again.

MongoChef is available for Windows, OSX, and Linux, and is compatible with all recent 2.x versions of MongoDB, along with the latest 3.0 release. It’s free for personal, non-commercial use, and a snip at US$69 + VAT for a commercial license.