This is Ross Albertson, and welcome to my blog. This series will discuss how I created an ASP.NET MVC 3 application using the RavenDB NoSQL database manager.
Well, for starters, I created an MVC 3 project in Visual Studio. I selected using HTML 5 markup and the Razor view engine. Before writing any code, I used the NuGet package manager to install the embedded version of Raven, using the command
install-package ravendb-embedded
That gave me Embedded Raven 1.0.888. When you try this, you might get a different version. The next step was to copy Raven.Studio.xap to the project directory. This enables the Silverlight part of the Raven server to run on the browser.
I also had to create a directory for the data. So, I made a folder called "Database" in the "Content" folder. I also had to direct Raven to that folder. To do that, I commented out the connection string entry in web.config that NuGet generated, and replaced it with
<add name="RavenDB" connectionString="DataDir=~\Content\Database"/>
The last bit of configuring I did was to change the default URL routing in global.asax.cs to
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{band_id}/{album_id}", // URL with parameters
new { controller = "Home", action = "Index", band_id = UrlParameter.Optional, album_id = UrlParameter.Optional } // Parameter defaults
);
That change enabled me to pass 2 IDs to my controllers. You'll see the reasoning behind that later. We'll be returning to that code file in the next installment.
Interesting. Questions: What motivated this particular project? What does it do? What are its goals? Would you classify this as a project for beginners, advanced programmers or something in the middle?
ReplyDelete