In my continuing series on NoSQL Databases I have been mainly describing some of the concepts behind NoSQL (and in particular Document) Databases.  In this post I will start to dive into some code.

As mentioned earlier I will be using RavenDB as this is a .NET friendly database.

In this first example lets create a simple ASP.NET MVC 3 Application that uses RavenDB as its data source.

I will start with a simple “My Tasks” Application which I created by using the Internet Application template in ASP.NET MVC 3.  Next I created a simple Task model class (Listing 1).

Listing 1: The Task class
    public class Task
    {
        public int TaskId { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public bool IsComplete { get; set; }
    }
 

I then used the Scaffolding available in ASP.NET MVC 3 to create a TaskController (Figure 1), as well as the Entity Framework DataContext class and all the Razor Views necessary for CRUD operations.

Figure 1: Scaffold a new TaskController class
image

And finally I created a SQL Server Compact Edition Database to store the data and a Tasks table with columns that matched the names and types of the Task class’s properties.

To prove that everything was wired up correctly I browsed to the application and added some data (Figure 2).

Figure 2: A List of Tasks
image

But the goal of this application is to use RavenDB as the database, not to create an EF Code First/SQL CE application.

As I mentioned in the 3rd post in this series, RavenDB can be configured in three different ways.  I am going to use the embedded mode.  Luckily, RavenDB is available as a NuGet package.  To add a NuGet package to a Visual Studio project we can right-click on the References folder (Figure 3).

Figure 3: Add a new Nuget package
image

and select “Manage NuGet Packages”.  In the Package Manager window enter Raven  in the search box and install the RavenDB (Embedded) package (Figure 4).

Figure 4: Install RavenDB using NuGet
image

The installation adds quite a few assemblies to the bin folder.

Next we need to configure Raven, so we will create a Folder in the App_Data folder call “Database” (Figure 5),

Figure 5: Create a new Database Folder for the RavenDB database
image

and we will modify the connection string that RavenDB added to the web.config to point to the folder we just created.

Listing 2: Update connection string in web.config
  <connectionStrings>
    <add name="RavenDB " connectionString="DataDir = ~\App_Data\Database" />
  </connectionStrings>
 

So now we are all set up ready to convert our application to use RavenDB, and in the next post I will show how to hook up the existing TaskController class, so we can store our tasks in an embedded RavenDB database instead of a SQL Compact database.


Posted in: Data , ASP.NET  Tags: , , ,

I am pleased to announce that I will be speaking at DevReach in Sofia, Bulgaria next month.  This is the sixth year for this conference - which bills itself as the Premier Conference on Microsoft Technologies in Eastern and Central Europe - but its the first time for me. 

In fact I have never been to any of the countries in Eastern Europe, the furthest east in Europe I have been being Vienna in Austria and Helsinki in Finland.

I am quite excited, both to be able to speak at this event – but also for the opportunity to experience Bulgaria.

I will presenting two sessions – one on Razor and one on building ASP.NET Applications using WebFormsMVP and the Model View Presenter pattern.

  • The Almighty @ - A Razor Primer

  • Have your Cake and Eat it Too – Using the WebFormsMVP Framework to Develop Testable Web Applications

While not focused on DotNetNuke – DotNetNuke plays a large part in both sessions – as DotNetNuke supports both Razor and the WebFormsMVP project.

So if you live in Eastern Europe – and are planning on attending DevReach – come and see my sessions and say Hi.

 devreach

Posted in: ASP.NET , DotNetNuke , Travel  Tags: ,

This year I have decided to place a bigger focus on speaking at Developer Conferences and so over the last few months I have been submitting session proposals to major conferences around North America.

I am pleased to say that many of my submissions have been accepted and I have quite a busy speaking calendar for the upcoming Spring conference season.

VSLive

Conference Dates: April 18-22, 2011
Venue: Rio, Las Vegas
Website: http://vslive.com/lv

VSLLV11_Speak_VLSPK23This excellent conference for .NET Developers is held two or three times a year and in April it will be held in Las Vegas.  I will be presenting two sessions at this conference.

  • The Almighty @ – A Razor Primer
  • WebMatrix Real World Data Centric Applications

If you would like to see me speak please use the registration code – VLSPK23 – for a $400 savings.

 

DevTeach

Conference Dates: May 30 – June 3, 2011
Venue: Intercontinental Hotel, Montreal, Canada
Website: http://www.devteach.com/

This excellent conference which is held annually in one of Canada’s 3 major cities, is this year planned for Montreal in the beautiful province of Quebec.  Come and see me speak on:

  • The Almighty @ – A Razor Primer
  • Have your Cake and Eat it Too - Using the WebFormsMVP Framework to Develop Testable Web Applications

Prairie DevCon

Conference Dates: June 13-14, 2011
Venue: Delta Regina, Regina, Saskatchewan, Canada
Website: http://www.prairiedevcon.com/

The Prairie Developer Conference is the conference event for software professionals in the Canadian prairies!  At this conference I will be teaming up with my son Andrew to give two Razor presentations

  • The Nurse2 Razor Show – Parts 1 and 2

Notice that the focus is Razor – Razor and WebMatrix are new technologies and DotNetNuke’s support for Razor means that I will be able to put a DNN spin on many of my speaking engagements.

If you plan on attending any of these conferences – ping me (@cnurse is my twiiter alias) – and we can meet up.


 Search Blog

 Calendar

«  February 2012  »
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011
View posts in large calendar

 Tags

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012 Thoughts from the Wet Coast