Monthly Archives: July 2011
Single Responsibility Prinicple
SRP is one of the easiest principles to learn, but one of the hardest to master. The reason to this is that it can be quite hard to see if a method or class breaks SRP or not. I got … Continue reading
A less evil singleton
I’ve been working a bit more with my Griffin Framework and I’m almost ready to release the Specification library in it. The specification library is an abstraction layer similar to CommonLog and CommonServiceLocator although it contains alternatives to both of … Continue reading
Reintroducing my compiler class.
I created a class a couple of years ago which simplifies the CodeCom handling when you want to dynamically create objects in .NET. I got reminded of it when I read a question at stackoverflow.com. The class can be used … Continue reading
Three reasons to why you should use view models
I’m answered a couple of questions at stackoverflow regarding the benefit of view models. Here is a summary of all my answers focusing on view models in ASP.NET MVC. Reason 1: Remove logic from your views. When you start working … Continue reading
Generic type restriction for enums
I was looking for a way to restrict a generic type identifier to only allow enums. Since you are not allowed to use where T : Enum I checked the metadata for Enum and found that it implements ValueType, IComparable, … Continue reading
Render a view to a string variable
It’s sometimes useful to render a view or a partial to a string variable instead of returning an ActionResult. the following code does just that, add it to your base controller.
How to create documentation using code comments.
Use the regular XmlDoc tags to document your code, it’s usually enough to type /// in Visual studio to get the default tags. Then use SandCastle to generate documentation. It can create regular help files, but also web based help. … Continue reading
jquery ui autocomplete: Uncaught TypeError: Cannot read property ‘element’ of undefined
I got that exception when I loaded some options through JSON (with ASP.NET MVC). It took a lot of digging before I finally found what the cause was. And it’s not what I expected: I’ve made a custom menu plugin … Continue reading