Why ADO.NET Not your father’s Data Access.

Slides:



Advertisements
Similar presentations
17. Data Access ADO.Net Architecture New Features of ADO.NET
Advertisements

ADO.Net Modelo para acesso a dados nas aplicação.Net Componentes: DataSet.Net Data providers: Connection Command DataReader DataAdapter.
ADO.NET: Working in Disconnected Environment Sergey Baidachni MCT, MCSD, MCDBA.
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.
1 ADO.NET. 2.NET Framework Data Namespaces System.Data –Base set of classes and interfaces for ADO.NET System.Data.Common –Classes shared by the.NET Data.
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.
.NET Mobile Application Development Data in Distributed Systems Accessing Data with.NET.
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.
Programming in ADO.NET: Data-Centric Applications and ADO.NET Original copyright by Microsoft, 2002, with minor modifications by Dan Eaves, 2005.
Objective In this session we will discuss about : What is ADO. NET ?
Mobile Data with the Compact Framework Shawn Wildermuth Senior Consultant/Architect Magenic Technologies Shawn Wildermuth Senior Consultant/Architect Magenic.
Overview of ADO.NET Chapter 1 ADO.NET 4.0 Development.
ADO.NET Tips and Tricks How to get the most out of your data access…
SQL Azure Database Windows Azure SQL Database is a feature-rich, fully managed relational database service that offers a highly productive experience,
ADO.NET – part II August 2004 [ Marmagna Desai]. CONTENTS ADO vs ADO.NET ADO.NET – Managed providers Connecting to Database SqlConnection Selecting Database.
ODBC, OLE DB, and ADO Introduction Dr. Ron Eaglin.
Overview of ADO.NET with the.NET Framework Scalable Development, Inc. Building systems today that perform tomorrow.
1 ASP.NET ASP.NET Rina Zviel-Girshin Lecture 4. 2 Overview Data Binding Data Providers Data Connection Data Manipulations.
A Simple Introduction. What is ADO.net? First the word ADO stands for ActiveX Data Objects And it is an integral part of.Net Framework of Microsoft hence.
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
Databases and Data Access  Introduction to ADO.NET  ADO.NET objects  ADP.NET namespaces  Differences between ADO and ADO.NET.
.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.
Chapter 3 Introduction to ADO.NET 3.1 The ADO and ADO.NET ActiveX Data Object (ADO) is developed based on Object Linking and Embedding (OLE) and Component.
Moving from Microsoft ® ADO 2.X To ADO.NET Jackie Goldstein Renaissance Computer Systems Ltd. MSDN Regional Director, Israel Prerequisites.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL ADO.Net Basics Ruwan Wijesinghe Trainer.
ASP.NET Rina Zviel-Girshin Lecture 5
Module 9: Accessing Relational Data Using Microsoft Visual Studio.NET.
Session 8: ADO.NET. Overview Overview of ADO.NET What is ADO.NET? Using Namespaces The ADO.NET Object Model What is a DataSet? Accessing Data with ADO.NET.
Module 7: Accessing Data by Using ADO.NET
© 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:
1.Net programmingADO.NETNOEA / PQC ADO.NET Architecture Connection factory Config file DataReader DataSet DataGrid Autogeneration of SQL.
Presented by Joseph J. Sarna Jr. JJS Systems, LLC
An Introduction to ADO.Net Marmagna Desai.NET Seminar, Fall-2003.
ADO.NET Tips and Tricks How to get the most out of your data access…
ADO.NET connections1 Connecting to SQL Server and Oracle.
 It is the primary data access model for.Net applications  Next version of ADO  Can be divided into two parts ◦ Providers ◦ DataSets  Resides in System.Data.
1 Data Classes- DataView DataGridView Control. Objectives 2  Data Class  DataAdapter  DataReader  DataSet  DataTable  DataView  DataGridView Control.
Database Farming For Improved Performance Presented By: Russell Yong Supervisor: Prof Wentworth.
DEV383 The ADO.NET DataSet and You Jackie Goldstein General Manager Renaissance Computer Systems
Accessing Data with Microsoft Visual C# Applications.
Why ADO.NET Not your father’s Data Access.
ADO.NET in Action Promises Realized.
HNDIT Rapid Application Development
DataSets Demystified. Who I am Shawn Wildermuth Senior Consultant with Magenic Technologies ( C# MVP INETA.
AUC Technologies Projects Consulting, Development, Mentoring, and Training Company ADO.NET Presented By : Muhammad Atif Hussain Deputy Manager IT (Takaful.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
Module 4 Introduction ADO.NET.
SQLXML XML Technology For SQL Server Brian Moore Developer and Platform Strategy Group Microsoft Corporation.
C# .NET Software Development
Active Data Objects Using.Net ADO.Net Farooq Ahmed Amna Umber Summayya Shehzad.
Module 5 Data Classes DataView – DataGridView Control 1.
Introduction to ADO.Net Malek Kemmou CEO Arrabeta
Querying Information in a Database. CONTENTS Relational Database Systems Creating Database with SQL Server Reading Data with LINQ Requirements to Get.
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
C# 1 CSC 298 ADO.NET. C# 2 ADO.NET  A data access technology that maps very well to the world of the web (disconnected architecture)  data is retrieved.
 ADO.NET is an object-oriented set of libraries that allows you to interact with data sources  Commonly, the data source is a database, but it could.
Data Access with ADO.NET
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
ADO.NET and Stored Procedures
ADO.NET Framework.
An Introduction to ADO.Net
מתחברים למסד נתונים היכרות עם ADO.Net.
Chapter 10 Accessing Database Files
Introduction to Database Programming through ADO. NET
Presentation transcript:

Why ADO.NET Not your father’s Data Access

Who I am Shawn Wildermuth Shawn Wildermuth Author of “Pragmatic ADO.NET Author of “Pragmatic ADO.NET Editor of Editor of For More Info: For More Info: This Presentation can be found at: This Presentation can be found at: –

Short History of Data Access VT Objects VT Objects Data Access Objects (DAO/Jet) Data Access Objects (DAO/Jet) Open Database Connectivity (ODBC) Open Database Connectivity (ODBC) OLE for Databases (OLE/DB) OLE for Databases (OLE/DB) ActiveX Data Objects (ADO) ActiveX Data Objects (ADO)

Why is ADO.NET Better? Disconnected by Design Disconnected by Design Relational by Nature Relational by Nature Integration with XML Integration with XML Framework Supports Real Database Schema Framework Supports Real Database Schema

Connected vs. Disconnected “The Pizza Delivery Guy” “The Pizza Delivery Guy” Connections are expensive Connections are expensive Keeping connections alive longer than necessary is extremely wasteful Keeping connections alive longer than necessary is extremely wasteful Long lived connections impede load balancing Long lived connections impede load balancing Connections unnecessary while manipulating database results Connections unnecessary while manipulating database results

Introducing ADO.NET Managed Providers Managed Providers DataSet DataSet DataBinding in ASP.NET DataBinding in ASP.NET DataBinding in WinForms DataBinding in WinForms

Managed Providers ADO.NET’s Version of Providers (ADO, OLE/DB) and Drivers (ODBC) ADO.NET’s Version of Providers (ADO, OLE/DB) and Drivers (ODBC) Not the only way to access data in.NET (most notably the Xml classes) Not the only way to access data in.NET (most notably the Xml classes) Made up of a number of managed classes that implement known interfaces Made up of a number of managed classes that implement known interfaces

System.Data Namespace Dataset etc. DataRow DataColumn Data Relation ForeignKeyConstraintDataTable System.Data.Common Namespace etc. DataTableMapping DbDataRecord DataAdapter Your Provider YourCommand YourConnection YourDataReader etc. System.Data.OleDb Namespace OleDbCommand OleDbConnection OleDbDataReader etc. System.Data.SqlClient Namespace SqlCommand SqlConnection SqlDataReader etc.

Managed Provider Abstraction System.Data DataSet System.Data.SqlClient SqlConnection SqlErrors SqlDataAdapter SqlDataReaderSqlCommand SqlParameter SqlParameters SqlError

using System; using System.Data; using System.Data.OleDb; class HelloADONET { static void Main() { } OleDbConnection conn = new OleDbConnection("..."); conn.Open(); OleDbCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM AUTHORS"; OleDbDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) Console.WriteLine(rdr["au_id"]); conn.Close();

What are DataSets? Disconnected set of Database Data? Disconnected set of Database Data? In-Memory Database (IMDB)? In-Memory Database (IMDB)? A complex, relational data structure with built-in support for XML serialization? A complex, relational data structure with built-in support for XML serialization? All three? All three?

The DataSet DataSet Tables DataTable Rows DataRow

using System; using System.Data; using System.Data.SqlClient; class HelloADONET { static void Main() { } SqlConnection conn = new SqlConnection("..."); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = conn.CreateCommand(); da.SelectCommand.CommandText = "SELECT * FROM AUTHORS"; DataSet dataSet = new DataSet(); da.Fill(dataSet);

Typed DataSets Strong Typing Strong Typing XSD Based Schema XSD Based Schema Simple to Setup relationships, constraints, etc. Simple to Setup relationships, constraints, etc. Not very much use if you have amorphous data Not very much use if you have amorphous data

Type DataSet Demo

Using DataSets Bulk Data Loading is supported Bulk Data Loading is supported Two possible versions of all data, RowState.Original and RowState.Modified Two possible versions of all data, RowState.Original and RowState.Modified Relationship Navigation Relationship Navigation DataViews DataViews

The Hard Part Disconnected Concurrency Disconnected Concurrency –Optimistic Concurrency Supported by CommandBuilders –Optimistic Concurrency could be more efficient –Pessimistic Concurrency can be achieved with Check-out, Check-in

XML Integration DataSets XML Serialization DataSets XML Serialization –You can control the Serialization –Full XSD Support –Supports DiffGrams XmlDataDocument XmlDataDocument –View DataSets as XmlDocuments SqlCommands and XmlReader SqlCommands and XmlReader

Practical Applications of DataSets Stop Writing Business Objects! Stop Writing Business Objects! –Derive from Typed DataSets –Let ADO.NET do the Database work –Write Just Your Business Logic –Deal with data as Relationally –or Hierarchically by using XmlDataDocument

Scalability in ADO.NET Scalability in ADO.NET Scale Out the Database as DataSets in the Middle Tier Scale Out the Database as DataSets in the Middle Tier Use DiffGrams to Keep DataSets in Sync Use DiffGrams to Keep DataSets in Sync With SQL Server 2K With SQL Server 2K –Can use DiffGrams to update the database –Caveats about different DiffGram format

DataBinding in ASP.NET ASP.NET DataBinding is read-only ASP.NET DataBinding is read-only –Can bind with DataReaders (but troublesome)

DataBinding in ASP.NET (2) using System.Data; using System.Web.UI; using System.Web.UI.WebControls; protected ListBox ListBox1; DataSet dataSet = new DataSet(); //... // DataBind ListBox1.DataSource = dataSet; ListBox1.DataMember = "Customers"; ListBox1.DataTextField = "CompanyName"; ListBox1.DataValueField = "CustomerID"; ListBox1.DataBind();

DataBinding in WinForms Different from ASP.NET Different from ASP.NET –Fully bidirectional –No need to call DataBind() –Allows binding to any property using System.Data; using System.Windows.Forms; DataSet dataSet = new DataSet(); //... listBox1.DataSource = dataSet.Tables[0]; listBox1.DisplayMember = "CompanyName"; listBox1.ValueMember = "CustomerID";

DataBinding in WinForms (2) Master-Detail Binding Master-Detail Binding –Set multiple object to same DataSource –Set DataMember to name of Relationship –Use CurrencyManager to move the cursor if you do not want to use the master control

Quick Rants Classic ADO has a role in.NET Classic ADO has a role in.NET Batch Queries are cool! Batch Queries are cool! Caveats for SqlClient’s Connection Pooling Caveats for SqlClient’s Connection Pooling Trust your DBAs and strive to be like them : ) Trust your DBAs and strive to be like them : )

Questions?