Package Manager Console For More Than Managing Packages

Like most developers, I prefer to not have to pick up the mouse if I don't have to. I use the Executor [http://executor.dk/] launcher for almost everything so it's extremely rare for me to ever click the "Start" button in Windows. I also use shortcuts keys when I can so I don't have to pick up the mouse. By now most people know that the Package Manager Console that comes with NuGet [http://nuget.codeplex.com/] is PowerShell embedded inside of Visual Studio. It is based on its PowerConsole [http:...


Use a Fake Http Channel to Unit Test with HttpClient

Applications get data from lots of different sources. The most common is to get data from a database or a web service. Typically, we encapsulate calls to a database in a Repository object and we create some sort of IRepository interface as an abstraction to decouple between layers and enable easier unit testing by leveraging faking and mocking. This works great for database interaction. However, when consuming a RESTful web service, this is is not always the best approach. The WCF Web APIs [htt...


MVC 3 AdditionalMetadata Attribute with ViewBag to Render Dynamic UI

A few months ago I blogged about using Model metadata to render a dynamic UI in MVC 2 [http://geekswithblogs.net/michelotti/archive/2010/09/08/mvc-2-model-metadata-to-render-dynamic-ui.aspx] . The scenario in the post was that we might have a view model where the questions are conditionally displayed and therefore a dynamic UI is needed. To recap the previous post, the solution was to use a custom attribute called [QuestionId] in conjunction with an "ApplicableQuestions" collection to identify w...


Running a WCF REST Service in IIS 7.5 with No *.svc file

Setting up a WCF RESTful service is extremely easy to do. In fact, you can do this with no *.svc file and no config file [http://geekswithblogs.net/michelotti/archive/2010/08/21/restful-wcf-services-with-no-svc-file-and-no-config.aspx] . However, you might run into a situation where your service worked fine during development using the Visual Studio web server but when you deploy to IIS 7.5 it no longer works. Specifically, for a simple request like http://localhost/help you get the error: "HTT...


Combine WCF MediaTypeProcessors with a Custom Razor Host

There is a bunch of cool stuff coming out of Microsoft right now. As I've previously blogged [http://geekswithblogs.net/michelotti/archive/2010/11/07/the-time-is-now-to-start-checking-out-the-wcf.aspx] , WCF Web APIs is one of them. One of the cool things that was shown by Glenn Block at PDC [http://player.microsoftpdc.com/Session/17a9e09f-4af1-4ef3-8a5a-ebf1e9bd9c8e] a couple of weeks ago was Media Type Processors. Media Type Processors provide a way to allow the consumer of your service to be...