Apr 12
Updated 01 Oct 2012 for version 1.0.960
About a month ago now I used RavenDB for the first time in a ‘real’ application. I think it’s awesome, frictionless and easy to get up and running. However I’ve heard from fellow developers that they think there is a high barrier to entry when compared to a traditional RDBMS approach such as SQL server. Yes when learning anything new there is a learning curve, but this post is to dispel the myth that setting up RavenDB is hard and to show you what you get for pretty much zero effort.
There are two flavours of RavenDB server and embedded. I’m going to show you in this post how to set up RavenDB embedded inside your MVC application.
Prerequisites
All you need installed is MVC 3 (steps are the same for MVC 4) and NuGet.
Continue reading »
Tagged with: ASP.NET • EmbeddableDocumentStore • MVC • Ninject • RavenDB
Jan 10
I’ve been making use of the JsonValueProviderFactory a lot lately. The JsonValueProviderFactory was released as part of MVC 3 and is a really easy way to introduce Json into your web application. In fact all MVC 3 websites support posting Json off the bat with no code changes. Phil Haack wrote an excellent blog post introducing the JsonValueProviderFactory.
One limitation I’ve found with the current JsonValueProviderFactory is when you have a property in your model that is a dynamic type. Unfortunately the JsonValueProviderFactory is unable to bind deserialized Json to a dynamic property. Example below:
Continue reading »
Tagged with: ASP.NET • dynamic • Json • Json.Net • JsonValueProvider • JsonValueProviderFactory • MVC 3
Nov 29
To use this extension download and reference MVC 2 Futures .
public static string ActionFor<TController>(this UrlHelper helper, Expression<Action<TController>> action) where TController : Controller
{
return Microsoft.Web.Mvc.LinkBuilder.BuildUrlFromExpression(helper.RequestContext, helper.RouteCollection, action);
}
To use this extension in a view use:
Url.ActionFor<MyControllerType>(controller=>controller.MyAction())
Continue reading »
Tagged with: Action • ActionFor • ASP.NET • DisplayFor • Expression • LinkBuilder • Magic String • MVC 2 Futures • MVC 2.0 • UrlHelper
Jul 29
In April I did a comprehensive blog post about the Html.EditorFor() and Html.DisplayFor() helpers in MVC 2, and there use with templates. It turns out I missed quite a cool feature added in the MVC 2 RTM release in March.
Taken from the release notes:
ASP.NET MVC 2 now includes new overloads of the EditorFor and DisplayFor methods. These overloads contain a parameter that accepts an anonymous object that can be used to provide extra view data. The view data provided in this parameter is merged with any existing view data that is passed to the template.
This new overload is very handy for providing additional information to your template without any nasty hacks. In this post we are going to continue our Employee example from my MVC Templates and MVC Model Binders posts, we will change the code to make use of the new overload.
Continue reading »
Tagged with: ASP.NET • DisplayFor • EditorFor • MVC 2.0 • Separation of Concerns • Templates
May 21
In the last section of my MVC Templates post, I discussed how to use the Html.EditorFor() helper with complex types. Whilst this showed how you can use Html.EditorFor() and templates to produce a user interface for complex types, it didn’t show you how to bind the result when the user has posted to a controllers action. In this post I will extend the employee example, so that it displays the offices the the user selected.
Continue reading »
Tagged with: ASP.NET • Convention over configuration • DisplayFor • Model Binders • MVC 2.0 • Templates
Recent Comments