I’m working on an asp.net mvc 3 powered site (for my wedding actually!), where I decided to try out some new technologies I’ve been wanting to play with for a while.
The first technology is the combination of EF 4.0 (AKA Entity Framework), and the new SQL Server Compact 4.0, which is working nice so far, and hopefully I’ll elaborate more in the matter in a future post.
The most important thing I wanted to test though was asp.net mvc 3 (RC), running on .NET 4, especially the usages of the dynamic
keyword.
You can now pass dynamic values instead of the ViewData
magic string dictionary, setting values on the page level, view level etc.
This introduces a blessed flexibility, and saves time.
Here’s a small example where I used it:
|
|
I have a method for Login
on my controller, which get’s the ReturnUrl
from the authentication filter (AKA, if you visit a route that has the [Authorize] filter before logging in, you’ll be redirected to the Login
method, and the .Net framework appends the query string ReturnUrl
to the request).
Peaches, now for the view:
|
|
Does of you with a sharp eye have already seen what I failed in.
|
|
Should have been:
|
|
And yes, a unit test would have caught that.
</rant>