Intro to C#.net and EF Ilan Shimshoni. The Three Faces of ADO.NET The connected layer – Directly connecting to the DB The disconnected layer – Using datasets.

Slides:



Advertisements
Similar presentations
Programming with ADO.NET By Sam Nasr April 27, 2004 Programming with ADO.NET By Sam Nasr April 27, 2004.
Advertisements

Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
Introduction to Database Processing with ADO.NET.
ADO. NET. What is “ADO.Net”? ADO.Net is a new object model for dealing with databases in.Net. Although some of the concepts are similar to the classical.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Objective In this session we will discuss about : What is ADO. NET ?
Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify.
Introduction to ADO Entity Framework ir Denis VOITURON Source:
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
ADO.NET. ADO.NET deals with accessing and manipulating databases.it comprises of many namespaces and classes to do so. ADO.NET provides access to datasources.
ADO.NET – part II August 2004 [ Marmagna Desai]. CONTENTS ADO vs ADO.NET ADO.NET – Managed providers Connecting to Database SqlConnection Selecting Database.
Entity Framework, a quickstart Florin−Tudor Cristea, Microsoft Student Partner.
ADO.NET. ADO.NET deals with accessing and manipulating databases.it comprises of many namespaces and classes to do so. ADO.NET provides access to datasources.
MS Access Database Connection. Database? A database is a program that stores data and records in a structured and queryable format. The tools that are.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
1 ASP.NET ASP.NET Rina Zviel-Girshin Lecture 4. 2 Overview Data Binding Data Providers Data Connection Data Manipulations.
Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases.
Accessing SQL Server and OLE DB from.NET Svetlin Nakov Telerik Corporation
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Databases and Data Access  Introduction to ADO.NET  ADO.NET objects  ADP.NET namespaces  Differences between ADO and ADO.NET.
Entity Framework Overview. Entity Framework A set of technologies in ADO.NET that support the development of data-oriented software applications A component.
.NET Data Access and Manipulation ADO.NET. Overview What is ADO.NET? Disconnected vs. connected data access models ADO.NET Architecture ADO.NET Core Objects.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL ADO.Net Basics Ruwan Wijesinghe Trainer.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
ASP.NET Rina Zviel-Girshin Lecture 5
Module 9: Accessing Relational Data Using Microsoft Visual Studio.NET.
CS 1308 Computer Literacy and the Internet
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Introduction to ADO.NET ADO.NET - Lesson 01  Training time: 10 minutes  Author:
Presented by Joseph J. Sarna Jr. JJS Systems, LLC
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
C# Programming in Depth Prof. Dr. Bertrand Meyer March 2007 – May 2007 Chair of Software Engineering Lecture 10: Database Lisa (Ling) Liu.
1 11/10/05CS360 Windows Programming ADO.NET. 2 11/10/05CS360 Windows Programming ADO.NET  Behind every great application is a database manager o Amazon.
Ventsislav Popov Crossroad Ltd.. 1. ASP.NET Data Source Controls  SqlDataSource  EntityDataSource  ObjectDataSource 2. Entity Data Model and ADO.NET.
Module 3: Working with Local Data. Overview Using DataSets Using XML Using SQL Server CE.
HNDIT Rapid Application Development
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
Module 4 Introduction ADO.NET.
C# .NET Software Development
Module 2: Using ADO.NET to Access Data. Overview ADO.NET Architecture Creating an Application That Uses ADO.NET to Access Data Changing Database Records.
ADO.NET 3.0 – Entity Data Model Gert E.R. Drapers Chief Software Architect Visual Studio Team Edition for Database Professionals Microsoft Corporation.
Data Access. ADO.NET ADO.NET is the primary library for building database solutions within the.NET Framework. ADO.NET does not replace ADO. ADO and OLEDB.
ADO .NET from. ADO .NET from “ADO .Net” Evolution/History of ADO.NET MICROSOFT .NET “ADO .Net” Evolution/History of ADO.NET History: Most applications.
.NET Data Access and Manipulation
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
ASP.NET Programming with C# and SQL Server First Edition
Introduction to ADO.NET
DB Apps Introduction Intro to ADO.NET SQL SoftUni Team DB Apps Intro
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
Unit 9.1 Learning Objectives Data Access in Code
Relational Model.
ADO.NET Framework.
Active Data Objects Binding ASP.NET Controls to Data
ADO.NET Entity Framework
MS Access Database Connection
Tonga Institute of Higher Education
An Introduction to Entity Framework
.NET Database Technologies:
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Jeff Webb Maria Baron Chris Hundersmarck
Database Objects 1/12/2019 See scm-intranet.
Chapter 10 ADO.
04 | Data Acess Technologies
Updating Databases With Open SQL
Active Data Objects Binding ASP.NET Controls to Data
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Updating Databases With Open SQL
Presentation transcript:

Intro to C#.net and EF Ilan Shimshoni

The Three Faces of ADO.NET The connected layer – Directly connecting to the DB The disconnected layer – Using datasets Connection through the Entity Framework (EF) – Automatically defining the relation between the DB and the C# classes and working with LINQ.

The connected layer

.Net Platform Data Provider Database Client Assembly Connection Object DataReader Object DataAdaptor Object Transaction Parameter Collection Select Command Update Command Delete Command Insert Command

Insert Method public void InsertAuto(NewCar car) { // Format and execute SQL statement. string sql = string.Format("Insert Into Inventory" + "(CarID, Make, Color, PetName) Values" + "('{0}', '{1}', '{2}', '{3}')", car.CarID, car.Make, car.Color, car.PetName); // Execute using our connection. using (SqlCommand cmd = new SqlCommand(sql, this.sqlCn)) { cmd.ExecuteNonQuery(); }

Select Method public List GetAllInventoryAsList() { // This will hold the records. List inv = new List (); // Prep command object. string sql = "Select * From Inventory"; using (SqlCommand cmd = new SqlCommand(sql, this.sqlCn)) { SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { inv.Add(new NewCar { CarID = (int)dr["CarID"], Color = (string)dr["Color"], Make = (string)dr["Make"], PetName = (string)dr["PetName"] }); } dr.Close(); } return inv; }

DataSets Client Application DataSet Data Adapter Database

DataSets Represents a database in memory Includes: – Tables – Relationships – Tables in include columns (fields) Constraints Name Datatype Unique? Column number (ordinal)

DataSets When the dataset is modified The modifications are known Errors are detected They can be written back to the database using the DataAdapter They can be rolled back

Datasets Gui and LinQ private void CreateDataView2() { dataGridYugosView.DataSource = from car in inventoryTable where (string)car["Make"] == "Yugo" select car; dataGridYugosView.DataError += new DataGridViewDataErrorEventHandler(DataGridView1_DataError); }

The Entity Framework The third layer

EF Separate the strong link between the DB and the program Build strongly typed objects classes to represent the DB in the program. These objects are called the Entity Data Model(EDM) A set of XML files called edmx files connect between the DB and the EDM classes.

EF components Object Services: – all EDM classes inherit from EntityObject. Its in charge of monitoring modifications to the object in order to then update the corresponding DB record(s) EntityClient namespace: – Its like a data provider but fro EDM objects. *.edmx files: – Conceptual model (Describe EDM classes) – Physical model (Describe DB tables and rels) – Logical model (relates the EDM to the DB tables)

All Together Now C# Code Object Services Entity Client Data Provider ADO.NET Data Provider Physical Database DbDataReader EntityDataReader *.edmx IEnumerable LINQ Query Entity SQL Command Tree

*.edmx files: DB Storage

Conceptual Model (EDM)

C-S mapping