Wednesday, February 29, 2012

Fluent NHibernate tip of the day: Don't use table names that represent other database objects

But if you have to, you can escape the table name using the back-tick (when you create the mapping). I found the answer on stackoverflow. In general I think you should rename your table instead of using the back-tick. However, sometimes you have to work with legacy databases and there's no other choice.

Sunday, February 26, 2012

Debugging ASP.NET MVC when the default model binder doesn't work

A few days ago I came across a strange problem with the default model binder in ASP.NET MVC. It turned out that the name of the parameter in an Action was "request", and this was confusing the default model binder.

It sounds simple to fix (just change the variable name), but the process to figure it out is not that easy. What will help you solve the problem is diving into the ASP.NET MVC framework source code. Follow this post to learn how to debug it. I also had to download the source code, add it to my solution and reference those projects.

Thursday, February 23, 2012

To mock or not to mock

Obviously the answer is yes. The real question is which mock framework to use. I personally recommend using moq. It is easy to use, provides strong-typed programming and has good examples/documentation. If you look at Google Trends, it also seems to be really popular.