1 / 13

Overview of Data Access

Overview of Data Access. MIS 324 Professor Sandvig. Overview. ADO.NET overview Data Access Displaying data. ADO.NET Overview. “ Any web application worth writing involves data access .” Stephen Walther ADO.NET ActiveX Data Objects Microsoft’s data access technologies

martinlloyd
Download Presentation

Overview of Data Access

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Overview of Data Access MIS 324 Professor Sandvig

  2. Overview • ADO.NET overview • Data Access • Displaying data

  3. ADO.NET Overview • “Any web application worth writing involves data access.” Stephen Walther • ADO.NET • ActiveX Data Objects • Microsoft’s data access technologies • Set of classes that provide data access services • Class Library: ADO.NET Overview

  4. ADO.NET Overview • Support for most relational databases • Sql Server • Oracle • MySql • Any ODBC compliant database • Open Database Connectivity standard

  5. .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

  6. Retrieving Data • MIS 324 • Will use programmatic approach • Benefits • Flexible • Uses SQL • Standard OOP programming techniques • MIS 424 • Entity Framework • Fast & convenient

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

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

  9. ORM – Object Relation Mapper • Maps model to sql parameters • Query results to model

  10. ORM • We use Dapper ORM • Developed by StackOverflow • For its site • “King of ORMs”

  11. Retrieving Data .NET MVC Steps: • Model • Database (Sql Server) • DataRepository • Controller • Views

  12. Example – Repository • See handout: Read Database • Output

  13. 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

More Related