"
 
 
 
ASP.NET (snapshot 2017) Microsoft documentation and samples

Part 1: Overview and Creating the Project

by Mike Wasson

Download Completed Project

Entity Framework is an object/relational mapping framework. It maps the domain objects in your code to entities in a relational database. For the most part, you do not have to worry about the database layer, because Entity Framework takes care of it for you. Your code manipulates the objects, and changes are persisted to a database.

About the Tutorial

In this tutorial, you will create a simple store application. There are two main parts to the application. Normal users can view products and create orders:

Administrators can create, delete, or edit products:

Skills You’ll Learn

Here’s what you’ll learn:

Although this tutorial is self-contained, you might want to read the following tutorials first:

Some knowledge of ASP.NET MVC is also helpful.

Overview

At a high level, here is the architecture of the application:

The following diagram shows how the domain objects are represented at various layers of the application: The database layer, the object model, and finally the wire format, which is used to transmit data to the client via HTTP.

Create the Visual Studio Project

You can create the tutorial project using either Visual Web Developer Express or the full version of Visual Studio.

From the Start page, click New Project.

In the Templates pane, select Installed Templates and expand the Visual C# node. Under Visual C#, select Web. In the list of project templates, select ASP.NET MVC 4 Web Application. Name the project “ProductStore” and click OK.

In the New ASP.NET MVC 4 Project dialog, select Internet Application and click OK.

The “Internet Application” template creates an ASP.NET MVC application that supports forms authentication. If you run the application now, it already has some features:

Membership information is persisted in a database that gets created automatically. For more information about forms authentication in ASP.NET MVC, see Walkthrough: Using Forms Authentication in ASP.NET MVC.

Update the CSS File

This step is cosmetic, but it will make the pages render like the earlier screen shots.

In Solution Explorer, expand the Content folder and open the file named Site.css. Add the following CSS styles:

[!code-cssMain]

   1:  .content {
   2:      clear: both;
   3:      width: 90%;
   4:  }
   5:   
   6:  li {
   7:      list-style-type: none;
   8:  }
   9:          
  10:  #products li {
  11:      width: 300px;
  12:      background-color: #aaf;
  13:      font-size: 1.5em;
  14:      font-weight: bold;
  15:      color: #ff0;
  16:      margin: 0 0 5px 0;
  17:      padding: 0 5px 0 5px;
  18:  }
  19:          
  20:  .price  {
  21:      float: right;
  22:      color: #c00;
  23:      font-size: 0.75em;
  24:  }
  25:          
  26:  .details thead td {
  27:      background-color: #CCCCCC;
  28:      color: #333333;
  29:  }
  30:   
  31:  .details td {
  32:  padding: 6px;
  33:  }
  34:          
  35:  .details td.qty {
  36:  text-align: center;
  37:  }       
  38:          
  39:  #cart a {
  40:  color: Blue;
  41:  font-size: .75em;
  42:  } 
  43:          
  44:  #update-products li { 
  45:      padding: 5px; 
  46:      color: #666;
  47:      border-style: dashed;
  48:      border-width: 2px;
  49:      border-color: #666;
  50:  }
  51:   
  52:  #update-products li .item {
  53:  width: 120px;
  54:  display: inline-block;
  55:  text-align: right;
  56:  }

Next





Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20>  <21>  <22>  <23
Link to this page: //www.vb-net.com/AspNet-DocAndSamples-2017/aspnet/web-api/overview/older-versions/using-web-api-1-with-entity-framework-5/using-web-api-with-entity-framework-part-1.htm
<SITEMAP>  <MVC>  <ASP>  <NET>  <DATA>  <KIOSK>  <FLEX>  <SQL>  <NOTES>  <LINUX>  <MONO>  <FREEWARE>  <DOCS>  <ENG>  <CHAT ME>  <ABOUT ME>  < THANKS ME>