Netvibes App for Windows Phone 8

This is just a quick post to announce a Windows Phone 8 app I’ve been working on, Netvibes Reader. It pulls in your RSS feeds aggregated on netvibes.com into native, WP8 app. You can download Netvibes Reader from the Windows Phone store. Phil
read more

Creating a proxy with ApiController

I’ve recently moved to MVC 4, and as part of the clean up work I’ve moved a lot of methods I use for AJAX operations to the new ASP.NET Web API, on controllers that inherit from ApiController. When it came to migrate a proxy action, I was amazed to find how much easier it is to build a proxy, with the method only taking a couple of lines. using System; using System.Net.Http; using System.Threading.Tasks; using System.Web.Http; using Http = System.Net.WebRequestMethods.Http; namespace PhilsVersion { public class ProxyController : ApiController { [AcceptVerbs(Http.Get,...
read more

Fixing HTML5 “Element ‘legend’ occurs too few times” in Visual Studio 2012

This is a minor annoyance at worst, but the VS2012 rules for <legend /> being mandatory in a <fieldset /> is wrong, legend should be optional. If you’re like me, and refuse to stand for such things, you can easily hack a couple of files to fix it, the files are as follows: C:Program Files (x86)Microsoft Visual Studio 11.0BlendHtmlSchemasenhtml_5.xsd C:Program Files (x86)Microsoft Visual Studio 11.0Common7Packagesschemashtmlhtml_5.xsd C:Program Files (x86)Microsoft Visual Studio 11.0Common7Packagesschemashtmlxhtml_5.xsd In each of the files, find the following line and change...
read more

ASP.NET MVC3 EditorFor that looks for inheritance

Today I ran into issue with MVC 3 where a view with a model type TModel won’t check to see if the model’s instance is a subclass of TModel, resulting in any attributes on overridden properties being ignored. This is because the metadata is read from the type specified in the view, and not the actual instance. For example, with the following class structure and view will never render “SomeProperty” as “required”, even if the model is an instance of InheritedClass. Classes: public class BaseClass { public virtual string SomeProperty { get; set; } } public class...
read more

OrderBy a string in Entity Framework

I’ve just started using Entity Framework, and I’ve found that it really helps speed up development time when dealing with queries where performance isn’t a huge issue. I added to an existing project which needed to keep the EF classes isolated in the data layer. This made it difficult to pass in a sort order without having a massive switch statement to deal with each of the options. I solved this by building an OrderBy extension method that takes a string, and builds the sort expression using reflection. This means you can sort without having to know the actual type of what...
read more

« Previous Entries