Overview of Data Access

Slides:



Advertisements
Similar presentations
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.
Advertisements

Stored Procedures & User Defined Functions MacDonald Ch. 23 MIS 424 MIS 424 Professor Sandvig Professor Sandvig.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
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 ?
Overview of Database Access in.Net Josh Bowen CIS 764-FS2008.
Sql Server Advanced Features MIS 424 Professor Sandvig.
Chapter 9 Using the SqlDataSource Control. References aspx.
Entity Framework Code First End to End
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
ODBC : Open Database Connectivity SNU OOPSLA Lab. October 2005.
Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
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.
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.
CHAPTER 14 USING RELATIONAL DATABASES TO PROVIDE OBJECT PERSISTENCE (ONLINE) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database.
Overview of Data Access MacDonald Ch. 15 MIS 324 Professor Sandvig.
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
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.
Databases and Data Access  Introduction to ADO.NET  ADO.NET objects  ADP.NET namespaces  Differences between ADO and ADO.NET.
1 Hammad Khan. COURSE CONTENTS.NET Framework And C# SQL Server 2008 ADO.NET LINQ ASP.NET Dynamics Data ASP.NET MVC framework 2 Advance C# Concepts Windows.
1 Introduction to ADO.NET Microsoft ADO.NET 2.0 Step by Step Rebecca M Riordan Microsoft Press, 2006.
Database, SQL, and ADO.NET- Part 1 Session 11 Mata kuliah: M0874 – Programming II Tahun: 2010.
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.
Module 7: Accessing Data by Using ADO.NET
3-Tier Client/Server Internet Example. TIER 1 - User interface and navigation Labeled Tier 1 in the following graphic, this layer comprises the entire.
Building Secure Web Applications With ASP.Net MVC.
ADO.NET connections1 Connecting to SQL Server and Oracle.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Adding Parameters to Commands ADO.NET - Lesson 06  Training time: 15 minutes.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
HNDIT Rapid Application Development
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
ODBC : Open Database Connectivity SNU OOPSLA Lab. October 2005.
Querying Information in a Database. CONTENTS Relational Database Systems Creating Database with SQL Server Reading Data with LINQ Requirements to Get.
Introduction to ORM Hibernate Hibernate vs JDBC. May 12, 2011 INTRODUCTION TO ORM ORM is a programming technique for converting data between relational.
Data Access Methodologies: When to choose what (ADO.NET, Entity Framework, WCF Data Services) Wriju Ghosh Lead Partner Consultant, Microsoft.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
.NET Data Access and Manipulation
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Using Stored Procedures ADO.NET - Lesson 07  Training time: 15 minutes  Author:
PHP + MySQL PDO PHPMyAdmin Practice: Vote system
ASP.NET Programming with C# and SQL Server First Edition
Data Access with ADO.NET
DB Apps Introduction Intro to ADO.NET SQL SoftUni Team DB Apps Intro
Introduction to Database Processing with ADO.NET
Model In MVC Mo Rezai.
Introduction to Entity Framework
LINQ for SQL SQL Saturday May 2009 David Fekke.
Introduction to Visual Basic 2008 Programming
Lecture 6 VB.Net SQL Server.
A very brief introduction
Haritha Dasari Josue Balandrano Coronel -
ADO.NET Accessing Databases in VS.NET
Overview of Data Access
MIS Professor Sandvig MIS 324 Professor Sandvig
ADO.NEXT Advances in Data Access for 2008
An Introduction to Entity Framework
מתחברים למסד נתונים היכרות עם ADO.Net.
Accessing Data in a .NET Web Application
MIS Professor Sandvig MIS 324 Professor Sandvig
Entity Framework Core (EF Core)
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Chapter 10 ADO.
MIS Professor Sandvig MIS 324 Professor Sandvig
Introduction to Database Programming through ADO. NET
Entity Framework & LINQ (Language Integrated Query)
MIS Professor Sandvig MIS 324 Professor Sandvig
Presentation transcript:

Overview of Data Access MIS 324 -- Professor Sandvig 7/5/2018 Overview of Data Access MIS 324 Professor Sandvig

MIS 324 -- Professor Sandvig 7/5/2018 Overview ADO.NET overview Data Access Displaying data

MIS 324 -- Professor Sandvig 7/5/2018 ADO.NET Overview “Any web application worth writing involves data access.” Stephen Walther ADO ActiveX Data Objects Microsoft’s data access technologies Set of classes that provide data access services Class Library System.Data

MIS 324 -- Professor Sandvig 7/5/2018 ADO.NET Overview Support for most relational databases Sql Server Oracle MySql Any ODBC compliant database Open Database Connectivity standard

MIS 324 -- Professor Sandvig 7/5/2018 .NET Data options Programmatically Use connection & command objects Pass SQL to database Very flexible approach Similar to PHP Entity Framework VS examines database Creates classes representing database structure Query with LINQ (language integrated query) Intellisense support Added to .NET 3.5 Proprietary Microsoft product

MIS 324 -- Professor Sandvig 7/5/2018 Retrieving Data MIS 324 Will use programmatic approach Benefits Flexible Uses SQL Standard OOP programming techniques MIS 424 Entity Framework Fast & convenient

MVC Approach Separation of duties: Model DataRepository class Describes application data DataRepository class Sql statements and data access classes Controller Handles requests View Displays data and forms

Repository All data access logic Goal: Loose coupling Sql statements Database classes Connection Etc. Goal: Loose coupling Different data source affects only repository

ORM Will use Object Relational Mapper Maps model to sql parameters Query results to model

ORM Dapper ORM Developed by StackOverflow For its site “King of ORMs”

ORM //Get one employee with Dapper public CrudModel GetOneEmployee(int id) { using (IDbConnection db = connection) string sql = "select Id, Fname, Lname from EmployeeDetails where id = @Id"; CrudModel employee = db.Query<CrudModel>(sql, new { id }).SingleOrDefault(); return employee; } //Get one employee without Dapper public CrudModel GetOneEmployeeNoDapper(int id) { //each sql parameter must be added as a parameter //each return value must be assigned to data object string sql = "select Id, Fname, Lname from EmployeeDetails where id = @Id"; SqlDataReader reader; using (SqlCommand command = new SqlCommand(sql)) //add input parameters. SqlParameter parm = new SqlParameter("@Id", id); command.Parameters.Add(parm); //execute reader = command.ExecuteReader(); } //create data object and assign values from reader CrudModel employee = new CrudModel(); while (reader.Read()) employee.Id = Convert.ToInt32(reader["id"]); employee.Fname = Convert.ToString(reader["Fname"]); employee.Lname = Convert.ToString(reader["Lname"]); }; return employee;

Retrieving Data .NET MVC MIS 324 -- Professor Sandvig 7/5/2018 Retrieving Data .NET MVC Create: Model Database (Sql Server) DataRepository Controller Views

MIS 324 -- Professor Sandvig 7/5/2018 Example – CRUD

Crud Example Controller contains 7 action methods Need 5 views

CRUD example Example (see handout for source)

MIS 324 -- Professor Sandvig 7/5/2018 Summary ADO.NET Classes that handle data access Provides consistent programming interface to data sources MVC Database access handled in DataRepository Controller calls repository methods Next: SQL Server Express Creating databases & using with ASP.NET