Running the Solutions

This solutions have a number of prerequisites, which you will need to set up before you can run it. Many developer machines will already have all of these things installed, but you will still need to change the connect string in the web.config

Prerequisites

  • You need Visual Studio 2010. I'm using this version because it includes more Entity Framework features, and because ASP.NET MVC 2 Preview 2 is already included, so if there is one less thing to install.
  • You need some version of Microsoft SQL Server. The free Developer or Express editions are fine. SQL Server 2005 or 2008 is recommended. Note that Express is included with Visual Studio.
  • You need the Northwind sample database. You will need to add this database to your SQL Server installation.
  • You need to modify the connectionString in the web.config file to point to the SQL Server installation on which you have installed Northwind.

Connection string

There are two different web.config files in the solution. One is in the MvcApplication1 folder, and the second is in the MvcApplication1/Views folder. The first one is the one which has the connection string which you need to change.

Note that this is an Entity Framework connection string, so it looks slightly different than a non-Entity Framework connection string. (Essentially, an Entity Framework connection string is a string with a bunch of Entity Framework-specific stuff, plus a "Provider connection string" embedded inside. It's the Provider which you need to change; you need to correct the server name, and you may need to change the authentication method, depending upon how you have configured SQL Server.) I will refer you to the http://msdn.microsoft.com/en-us/library/cc716756.aspx. The way to test to see if you've got this right is to just run the application; if you see the homepage, and no errors, then you've got the connection string right.

The connectionString looks like this:

<add name="NorthwindEntities" 
        connectionString="metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;provider=System.Data.SqlClient;
            provider connection string=&quot;Data Source=DSK-CSTUNTZ\SQLDEV2005;Initial Catalog=Northwind;Integrated Security=True;MultipleActiveResultSets=True&quot;" 
            providerName="System.Data.EntityClient"/>

The Data Source part is the part you need to change.

Last edited Oct 27, 2009 at 8:51 PM by CraigStuntz, version 1

Comments

No comments yet.