UpdateModel, FormCollection and Unit Test
March 29, 2009
I ran into some problems with an Action Controller method that accepted a FormCollection
. Inside the method, I use UpdateModel
to get the values from the form into the model class.
Here is a skeleton implementation of the method:
[UPDATED] Some insightful comments by Steve made me do some changes to this code. I have now updated it. The tip had to do with if the ValueProvider should be set on the Controller in the test or in the actual Action method. I finally opted for the latter and changed it into this (significant code in bold).
[AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection form) { // Create ViewData ProductForm viewData = new ProductForm(new Product(), productOwnerRepository.
Read More
Årets höjdare 2009
March 28, 2009
Last night, Avega hosted a fantastic party, complete with a performance by the Avega Band. The evening was filled with fun and excitement, and awards were handed out, including the SM I Affärsnytta among others.
To my surprise and delight, I was honored with the “Årets höjdare” award (Avegean of the Year)! This award is voted on by the consultants of Avega, and I was completely taken off guard. Last year’s recipient was Joakim Sundén, a remarkable individual who has made a significant impact on Avega’s presence in Sweden.
Receiving this award was incredibly humbling. Standing among such a knowledgeable and skilled group of colleagues, I felt deeply honored that they chose me as their favorite.

Thank you all for this amazing recognition. It is, by far, the finest reward I have ever received!
Thank you!
Read More
Sprint Planner Helper – Session 23
March 28, 2009
This has been the longest session of my project so far, spanning over four separate hours and nearly a week. My schedule was packed with other commitments, but I made significant progress.
The main challenge was grappling with some ASP.NET MVC framework issues related to data binding in views and the UpdateModel
method. To cut a long story short, I encountered difficulties and reached out for help on the MVC-forum. I received excellent feedback from Alberto, which you can read in my forum post.
Here are some key takeaways from this session:
- Use a Separate ViewModel: It’s crucial to create view-specific classes that streamline data handling between views and controllers.
- Naming Conventions in Views: For example, using
Html.TextBox("Product.Name", Model.Product.Name)
in the view and calling UpdateModel()
will correctly populate the Product
property with the new Name
value.
...
Read More
He walks!
March 23, 2009
Today was a milestone moment: Albert took his first real steps! After being so close for a couple of months, he finally walked back and forth between Elin and me.

It was an incredible experience to watch him gain control of his balance and see the confidence grow as he moved along.

Read More
Sprint Planner Helper – Session 22
March 22, 2009
I have had some serious thoughts on what to do next in my project. On one hand, I want to update the way I am doing the GUI for the product and product backlog. Right now I am warm and learning a lot about ASP.NET MVC so it feels quite good to continue there.
On the other hand, this is first and foremost a DDD-learning experience, and I have got stuck for a while in the ASP.NET MVC trench.
And finally, since I only have one hour, either way will take me on a detour from the other track. What to do?
After some serious consideration, I decided to spend today’s session on a DDD thing I ran into in the walkthrough. I want to implement the “IsValid and GetRuleValidations” pattern and include it in my BaseRepository
Save
method.
That will be enough for...
Read More
Ruby on Rails – supercool demo
March 22, 2009
Here is a demo of the famous Ruby On Rails framework that is just mind-blowing.
http://media.rubyonrails.org/video/rails_blog_2.mov
I can’t wait until the ASP.NET MVC framework comes up with something similar. Amazing. Truly amazing. Maybe I should switch gears…
Read More
De Blob – get a joy-kick!
March 21, 2009
I bought a new WII game yesterday – De Blob. It is a real fun-injection which I recommend to everyone. It such a good feeling to bring color to an all black and white surrounding.
Here is a short clip that introduce the game and the plot:
I’m sorry to say that it will ruin my Sprint Planner Helper project tonight. On that subject I can say that I am still wondering on how to redo the GUI. I am not fond on how it’s coming along.
Read More
Sprint Planner Helper – Session 21
March 20, 2009
I’m back! After doing a detour through the sample chapter of the upcoming ASP.NET MVC book (lovingly called “The Four Faces,” I heard…), I now feel ready to continue.
I learned a few things from that sample chapter—not just about ASP.NET MVC but also about some flaws in my DDD-ing, especially in the use of the Repository pattern.
The main thing is that I have a separate Update-method that feels a bit strange. Another thing I learned and finally understood was the IQueryable interface.
By using IQueryable, you can defer the execution of the actual database query until the client calls, which means that the query will be fine-tuned with all the parameters that the client includes (such as Take, Sort, etc.). For a much better explanation see this.
So, I’ll update my IRepository
to something like this:
Read More
ASP.NET MVC released!
March 19, 2009
OK – my new favorite framework is released! I am downloading it now!
Read More
MOQ and the Test Run deployment issue - The location of the file or directory problem
March 19, 2009
The NerdDinner example uses the MOQ-framework for mocking some authentication mechanism.
This framework is new to me and when I downloaded it (one dll – great stuff!) I immediately ran into the “Test Run deployment issue: The location of the file or directory” – exception.
Here is a great article explaining how to solve it. I needed to restart Visual Studio to get it to “take” – but then it worked great.
Read More