Asp.Net 3.5 Part 2

  • 2,318 views
Uploaded on

Asp.Net Introduction

Asp.Net Introduction

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,318
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
90
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Building Effective Web Applications with ASP .Net 3.5 ASIM SHAHZAD
  • 2. Overview of Data Access (Chapter 8) • 99.99% of apps involve some type of data • We can use data bound controls to generate our web application’s UI • SQL Server Express is a royalty free database included with VS2008 or Visual Web Developer.
  • 3. Types of Data bound Controls p337 • Lists • Tabular • Hierarchical
  • 4. Bind Controls to a DataSource p350 • SQLDataSource • LinqDataSource • AccessDataSource • ObjectDataSource • XmlDataSource • SiteMapDataSource
  • 5. Data Driven App Demos • Code From Chapter 8 1.Add/Configure a SQLDataSource 2.List Controls 3.Tabular 4.Hierarchical Data This demo uses an xml file as a data source. 5.CRUD Sample – Employee Directory
  • 6. Break • We will look discuss LINQ after break
  • 7. What is LINQ? • LINQ stands for Language Integrated Query • A general purpose query facility to query relational data, XML data, objects/collections. • New in .Net Framework 3.5 – must target .Net Framework 3.5 • Based on standard query operators • LINQ query syntax resembles backwards SQL statements
  • 8. LINQ Architecture C# 3.0 VB 9.0 .NET Language Integrated Query Others… LINQ to LINQ to LINQ to LINQ to Objects DataSets SQL XML <book> <title/> <author/> <year/> <price/> </book> Objects Relational XML
  • 9. Benefits of Using LINQ • May not need to build an entire DAL (data access layer) • Much easier to query XML – don’t have to use Xpath • Work with data in a consistent way – whether it is SQL Server data, XML data, ADO .Net dataset, an object collection, or data in memory • Offers compile time checking, autocompletion, and Intellisense
  • 10. New C# Language Features that Support LINQ p902 • Automatic properties • Initializers • Type Inference • Anonymous types
  • 11. Three Parts of a LINQ Query • Obtain the data source • Create the query • Execute the query
  • 12. What’s a DataContext? • The DataContext is the source of all entities mapped over a database connection • It tracks changes that you made to all retrieved entities and maintains an "identity cache" that guarantees that entities retrieved more than one time are represented by using the same object instance.
  • 13. LINQ Demos from MSDN Library Help Files • How to: Query an ArrayList with LINQ • LINQ to XML vs. DOM • Paste as XML C# Addin
  • 14. C# Building the Paste Xelement as XML Addin • http://www.hanselman.com/blog/PasteXM LAsXLinqXElementVisualStudioAddIn.asp x
  • 15. Creating LINQ to SQL Entities • Building Entities with the Object Relational Designer p922 • Using the LINQDataSource control p926
  • 16. Other MVC Resources • MSDN Virtual Lab on Introduction to .Net MVC • Discussion of .Net MVC can be found on www.asp.net/mvc/ • Book - Design Patterns by Gamma, Helm, Johnson, and Vlissides
  • 17. Other LINQ resources • www.thinqlinq.com • Book – LINQ in Action • Msdn.microsoft.com articles on LINQ
  • 18. Optional Take Home Class Exercise • Do any one of the following: 1.MSDN Virtual Lab “Using LINQ to SQL with the .Net Framework 3.5 and Visual Studio 2008” Event ID: 1032376015 (msevents.microsoft.com) 2. Download lab manual from #1, install Northwind database and do lab on your pc. 3.Do VS2008 Training Kit Lab “LinqToSql”
  • 19. Questions ? • Feel free to contact me at asimshahzad78@yahoo.com • Thank you!