ASP.NET
  Home arrow ASP.NET arrow Introduction to the ADO.NET Entity Framewo...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Introduction to the ADO.NET Entity Framework using ASP.NET
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2009-04-09

    Table of Contents:
  • Introduction to the ADO.NET Entity Framework using ASP.NET
  • CRUD operations using ADO.NET Entity Framework: Screen Design
  • CRUD operations using ADO.NET Entity Framework: Source Code
  • Digging a bit more into the ADO.NET Entity Framework
  • What are Entity SQL queries?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introduction to the ADO.NET Entity Framework using ASP.NET


    (Page 1 of 5 )

    This is an introductory article focusing on developing ASP.NET applications using the ADO.NET Entity Framework. In this article, we will make a detailed step-by-step examination of how to develop applications using the ADO.NET Entity Framework together with ASP.NET.

    This article is based on the following configuration: 

    • Windows Server 2003 with SP2

    • IIS

    • SQL Server 2008

    • Visual Studio 2008 (comes with .NET 3.5) with SP1 

    To make this article simple, I created a table structure which you can examine by clicking on the link.  

    The entire source code for this article is available in the form of two free downloadable zip files, which you can download here and here. The solution was developed using Microsoft Visual Studio 2008 Team Edition (with SP1), with Microsoft SQL Server 2008 Developer Edition on Microsoft Windows Server 2003 Standard Edition (with SP2). I didn't really test it in any other environment. I request that you post in the discussion area if you have any problems in execution. 

    Creating a simple application with ADO.NET Entity Framework 

    Let us start with a new solution: 

    • Open Start || Programs || Microsoft Visual Studio 2008

    • Go to File || New Project

    • In the "New Project" dialog, select "Web" in "Project Types" and select "ASP.NET Web Application" in templates.

    • Provide "Sample01" as the name and press "OK."

    • Right click on project and click on Add || New Item

    • In the "Add New Item" dialog, select "ADO.NET Entity Data Model" as the template, provide  "NWModel.edmx" as the name, and finally click on "OK."

    • Immediately, you will be provided with the "Entity Data Model Wizard." Select "Generate from database" to create a model and click "Next."

    • Provide database connectivity information and hit "Next."

    • Select "Emp," "Dept" in the list of tables, provide "NorthwindModel" as the namespace, hit "Finish."

    • Once the wizard completes, the Entity Designer looks like the following:


    • To make all the three entity mapping files (.csdl, .msl, .ssdl) copied to "bin" folder, configure as shown below:


    • Drag a button (btnEmpList) and GridView on to "Default.aspx"

    • Modify the code behind so that it looks like the following:

     

    Partial Public Class _Default

    Inherits System.Web.UI.Page

     

    Protected Sub btnEmpList_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnEmpList.Click

    Dim ctxt As New NorthwindEntities

    Me.GridView1.DataSource = From oEmp In ctxt.Emp _

    Select New With {.ID = oEmp.Empno, .Name = oEmp.Ename, .Salary = oEmp.Sal, .Dept = oEmp.Dept.Dname}

    Me.GridView1.DataBind()

    End Sub

     

    End Class

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · Hai,This is my first article on dealing with ADO.NET Entity framework with...
       · Thanks man it reduced me lot of lines of code.
     

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek