Setting up for Microsoft Entity Data Model projects
Download:pizza_edm.zip
Development System: I have used a PC
running Microsoft Server
2003 (32-bit), and also an XP system.
- If you can afford it, first install SQL Server 2005 Development
Edition or a complete SQL Server 2005 system on your development
machine or have it available on a local server. If you do this
after step 2, you will find that the VS Studio 2008 installation has
installed SQL Server 2005 Express for you, which doesn't have the SQL
Profiler, yet blocks installation of a better version of SQL Server
workstation tools because the Express version of these tools is newer.
To get around this, you need to uninstall SQL Server 2005 Express and
then install the better version of SQL Server 2005. However, you can
get along with SQL Server Express if you can stand not seeing all the
generated SQL of your application. You can see the query SQL via
ToTraceString.
- Install Microsoft
Visual Studio 2008.
- Install Visual Studio SP1 Beta (or SP1 itself once available). This has the EDM support.
- Optionally install more tools, samples.
- If you are using SQL Server 2005 Express (having skipped step 1)
can't find SQL Server Management Express Studio after this
(my experience), download and install it separately. With a
better SQL Server, you should have SQL Server Management Studio.
- Enable the distributed transaction service (DTC) in the Services
control panel on any system in use here. This is for EDM with
transactions, the setup used for the pizza project.
- Now you should have a working Visual Studio (VS) and SQL Server
2005. Check them out.
To get the pizza project up and running as a console or web
app project in VS:
- Using SQL Query Analyzer, execute the script pizzaDDL.sql to
create the pizza database in SQL Server 2005 (Express or not) or
SQL Server
2000.
- In VS, create a new C# ASP.NET web app or console project in a
new
directory.
- Right click the project icon in Solution Explorer, Add new item,
add Entity Data Model, call it PizzaModel.edmx, generated from database
tables in SQL Server Express (pizza database), saving as PizzaEntities
in App.config.
- Copy the other source files (.cs for both, .aspx as well for web
app) into the project, and "Add item, existent item" for them.
You
don't need ConsoleProgram.cs in a web app, or any file with "asp" in the file
name for a console project.
- Build the project. If necessary, if the web app build fails,
right click the .aspx files in Solution Explorer and convert them to
web forms.
- If it's a web app, execute from any selected web form, but most
naturally the first one. VS has a built-in web server and browser.
- If it's a console project, execute from ConsoleProgram
If you only want to execute the project, and have IIS installed, you
don't need the above development software:
1. Make sure it supports at least ADO.NET v 2.0, if not upgrade it (run
inetmgr to find out)
2. Copy this project to c:\pizza, or someplace similarly not too deep
in the file system, to avoid protection problems.
3. Use inetmgr > WebSites> Default WebSite> new virtual
directory, alias pizza, path c:\pizza, to define a new virtual
directory mapped to where this project resides.
4. Browse to http://localhost/pizza.
Home