• Like
Part 1
Upcoming SlideShare
Loading in...5
  • 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


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • 04/29/10 11:52 ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 100% backwards compatible Only show these slides for 300+
  • ADO.NET has come a long way for data access and manipulation but it’s still a non-optimal development experience that’s prone to errors. Take the example shown here: ConnectionStrings passed to SqlConnection objects must be Cut/Pasted from Visual Studio’s Database Connection wizard or coded by hand. The query itself would typically be Cut/Pasted from SQL Server Management Studio or Query Analyzer. Arguments to that query are loosely bound and passed as parameters through a Command object. The results of the query are loosely typed and oftentimes require conversion or casting to another type altogether before they get placed into a class or object that your app uses. Last, there are no compile-time checks leaving you the developer troubleshooting a variety of connectivity or syntax issues.
  • Now we see how a similar connection to SQL and query would be executed using LINQ to SQL. All of the plusses introduced with LINQ to Entities carry over here in a similar fashion. Most important however is that the actual query itself is now integrated directly into the language.
  • With Orcas, we have taken a more general approach and are adding general purpose query facilities to the .NET Framework that apply to all sources of information, not just relational or XML data. This facility is called .NET Language Integrated Query (LINQ). With Orcas and ADO.NET 3.5, LINQ is an inherent part of the C# and VB.Net languages offering both IntelliSense and Autocompletion. LINQ provides developers with a consistent query language which they in turn may use on various types of data. Be it Objects, XML, Datasets, SQL Server (or other databases with ADO.NET providers) and Entities. Any data that may be placed into a .NET collection of type IEnumerable<T> can be queried by LINQ. If you’ve written T/SQL in the past then LINQ will offer you familiar constructs for projections, restrictions, sorting and grouping such as Select, Where, GroupBy, and OrderBy. You can also adapt the query operators to your liking by using extension methods which can override their default behavior. <CLICK TO ADVANCE ANIMATION> Queries created in LINQ are not actually evaluated until they are iterated over – we call this Deferred Query Execution. As you can see here, the first iteration of this array of names yields Allen and Arthur as those names begin with the letter “A”. <CLICK TO ADVANCE ANIMATION> This deferred evaluation allows queries to be kept as IEnumerable<T> -based values that can be evaluated multiple times, each time yielding potentially different results. You can see here that we’ve edited the first name in our string array to “Bob”. Iterating over the query performs the query again, this time only “Arthur” is returned. <CLICK TO ADVANCE ANIMATION> In addition, many query operators allow the user to provide a function that performs filtering, projection, or key extraction. The query facilities build on the concept of Lambda Expressions, which provide developers a convenient way to write functions that can be passed as arguments for subsequent evaluation in their queries. In the example shown here, we’ve used Lambda Expressions to create projections, restrictions, and ordering to our query.


  • 1. ASP.NET 3.5 New Features
  • 2. Agenda
    • What's New in .NET Framework 3.5?
    • Visual Studio 2008 Enhancements
    • LINQ (Language Integrated Query)
    • New ASP.NET Server Controls
    • ASP.NET 3.5 Extensions
      • ASP.NET Dynamic Data ( now in SP1 )
      • ASP.NET MVC Framework ( now in Beta )
      • ASP.NET and AJAX Integration
      • ASP.NET Controls for Silverlight
  • 3. Timeline
    • November 2005     ASP.NET 2.0 Released along with Visual Studio 2005  (No ASP.NET AJAX)
    • January 2007         ASP.NET AJAX v1.0 released as an add-on to ASP.NET 2.0 (Works with Visual Studio 2005)
    • May 2007                 ASP.NET "Futures" a developer preview of some of the features considered for future releases released as a CTP
    • July 2007 ASP.NET "Futures" CTP Updated
    • November 2007     ASP.NET 3.5 and Visual Studio 2008 released (ASP.NET 3.5 contains built-in newer version of ASP.NET AJAX, ListView, DataPager and LinqDataSource controls)
    • December 2007    ASP.NET 3.5 Exensions (CTP Version containing new features for ASP.NET, AJAX and Silverlight)
    • August 2008 .Net 3.5 SP1
  • 4. What’s New in .NET Framework 3.5?
    • Language Integrated Queries (LINQ)
      • Family of technologies that provides querying features for data, from relational to XML
      • Generate a LINQ object model that provides an object representation of the database
    • New collections: HashSet<T>
    • Peer-to-Peer networking framework
    • Integration of WCF and WWF ( Workflow Services )
  • 5. What’s New in Visual Studio 2008?
    • Framework targeting (2.0, 3.0, 3.5)
    • Full support for LINQ and LINQ to SQL
    • Integrated ASP.NET AJAX
    • Improved HTML editor
      • Split source/design view
      • JavaScript IntelliSense and debugging
      • CSS manager and debugger
    • Integrated WPF, WCF, WF designers
    • Runs a bit slower
  • 6. Visual Studio 2008 Enhancements
  • 7. LINQ and LINQ to SQL
    • Query, set and transform operations for .NET
    • Querying data becomes a core programming concept
    • Works with all types and shapes of data
      • Relational databases
      • XML
      • Objects
    • Works with all .NET languages
      • C# and VB and have integrated language support
    • LINQ to SQL
      • Powerful ORM framework
  • 8. var contacts = from c in customers where c.State == &quot;WA&quot; select new { c.Name, c.Phone }; var contacts = customers .Where(c => c.State == &quot;WA&quot;) .Select(c => new { c.Name, c.Phone }); Extension methods Lambda expressions Query expressions Object initializers Anonymous types Local variable type inference Expression trees Automatic properties Partial methods
  • 9.
    • Implicitly typed locals
    • Extension methods
    • Lambda Expressions
    • Object initializers
    • Anonymous types
    • Nullable types
    • Query expressions
    • XML Literals
    Dim x = 5 <Extension> Sub Randomize(col As Collection) Function(c) c.Name New Point With { .x = 1, .y = 2 } New With { c.Name, c.Phone } From … Where … Select If emp.DOB >= Today
  • 10. SqlConnection c = new SqlConnection(…); c.Open(); SqlCommand cmd = new SqlCommand( @&quot;SELECT c.Name, c.Phone FROM Customers c WHERE c.City = @p0&quot;); cmd.Parameters[&quot;@p0&quot;] = &quot;London&quot;; DataReader dr = c.Execute(cmd); while (dr.Read()) { string name = dr.GetString(0); string phone = dr.GetString(1); DateTime date =dr.GetDateTime(2); } dr.Close(); Queries in quotes Loosely bound arguments Loosely typed result sets No compile time checks
  • 11. public class Customer { … } public class Northwind: DataContext { public Table<Customer> Customers; … } Northwind db = new Northwind(…); var contacts = from c in db.Customers where c.City == &quot;London&quot; select new { c.Name, c.Phone }; Classes describe data Strongly typed connection Integrated query syntax Strongly typed results Tables are like collections
  • 12.
    • Integrated, native query syntax in C# and VB
      • IntelliSense and Autocompletion
    • Query Operators can be used against any .NET collection (IEnumerable<T>)
      • Built-in examples: Select, Where, GroupBy, Join, etc.
      • Extensibility model supports extending/replacing these
    • Deferred Query Evaluation
    • Lambda Expressions
    using System; using System.Query; using System.Collections.Generic;   class app { static void Main() { string [] names = { &quot;Allen&quot;, &quot;Arthur&quot;, &quot;Bennett&quot; };   IEnumerable < string > ayes = names .Where(s => s[0] == 'A');   foreach ( string item in ayes) Console .WriteLine(item);   names[0] = &quot;Bob&quot;;   foreach ( string item in ayes) Console .WriteLine(item); } } Arthur using System; using System.Query; using System.Collections.Generic;   class app { static void Main() { string [] names = { &quot;Allen&quot;, &quot;Arthur&quot;, &quot;Bennett&quot; };   IEnumerable < string > ayes = names .Where(s => s[0] == 'A');   foreach ( string item in ayes) Console .WriteLine(item);   names[0] = &quot;Bob&quot;;   foreach ( string item in ayes) Console .WriteLine(item); } } Allen Arthur using System; using System.Query; using System.Collections.Generic;   class app { static void Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;, &quot;Frank&quot;, &quot;Everett&quot;, &quot;Albert&quot;, &quot;George&quot;, &quot;Harris&quot;, &quot;David&quot; };   IEnumerable < string > expr = from s in names where s.Length == 5 orderby s select s.ToUpper();   foreach ( string item in expr) Console .WriteLine(item); } } BURKE DAVID FRANK using System; using System.Query; using System.Collections.Generic;   class app { static void Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;, &quot;Frank&quot;, &quot;Everett&quot;, &quot;Albert&quot;, &quot;George&quot;, &quot;Harris&quot;, &quot;David&quot; };   Func < string , bool > filter = s => s.Length == 5; Func < string , string > extract = s => s; Func < string , string > project = s = s.ToUpper();   IEnumerable < string > expr = names .Where(filter) .OrderBy(extract) .Select(project);   foreach ( string item in expr) Console .WriteLine(item); } } BURKE DAVID FRANK
  • 13. LINQ to SQL
    • LINQ to SQL Designer in VS 2008
    NorthwindDataContext db = new NorthwindDataContext(); var customers = from c in db.Customers where c.City == &quot;London&quot; select c; foreach (var cust in customers) Console.WriteLine( &quot;id = {0}, City = {1}&quot;, cust.CustomerID, cust.City);
  • 14.
    • LINQ to Objects API
      • queries over any .NET collection, such as arrays and generic lists.
    • LINQ over XML (XLinq)
      • Core functionality of the XLinq API such as load, modify, and save XML documents
    • LINQ to SQL
      • provides direct access to database tables from the programming environment
    • LINQ to Entities
      • enables developers to use LINQ over EDM models
    • LINQ to Dataset
      • allows the full expressivity of LINQ to be used over Datasets.
  • 15. New ASP.NET Data Controls
    • <asp:ListView>
    • <asp:DataPager>
    • <asp:LinqDataSource>
  • 16. ListView Control
    • Combines templating capabilities of the Repeater control and the data editing capabilities of the DataGrid
    • complete control of how the ListView presents your data through 11 templates.
      • LayoutTemplate
      • AlternatingItemTemplate
      • EditItemTemplate
      • EmptyDataTemplate
      • EmptyItemTemplate
      • GroupTemplate
      • GroupSeparatorTemplate
      • InsertItemTemplate
      • ItemTemplate
      • ItemSeparatorTemplate
      • SelectedItemTemplate
    • most important templates are the LayoutTemplate and the ItemTemplate.
    • LayoutTemplate HTML defines the overall look and feel
    • ItemTemplate HTML specifies how each bound record will appear.
  • 17. ListView
    • <asp:ListView ID=&quot;ListView2&quot; runat=&quot;server&quot; DataSourceID=&quot;MyDataSource&quot;> <LayoutTemplate> <asp:PlaceHolder ID=&quot;itemPlaceholder&quot; runat=&quot;server&quot;> </asp:PlaceHolder> </LayoutTemplate> <ItemTemplate> <asp:Label ID=&quot;Company&quot; runat=&quot;server&quot; Text='<%# Eval(&quot;CompanyName&quot;) %>' /> <br /> <asp:Label ID=&quot;CityLabel&quot; runat=&quot;server&quot; Text='<%# Eval(&quot;City&quot;) %>' /> <hr /> </ItemTemplate> </asp:ListView>
  • 18. DataPager
    • provides paging capabilities.
    • points at the control it provides paging support for. As an external control
    • place it anywhere on the page, and configure look
    • works with controls that implement the IPageableItemContainer interface ( ListView )
  • 19. DataPager
  • 20. LinqData Source Control
    • Bind to a Linq Data Model
  • 21. ASP.NET 3.5 Extensions
    • ASP.NET MVC Framework
      • Model View Controller framework for ASP.NET ( now in Beta )
    • ASP.NET Dynamic Data
      • Dynamic data controls for displaying/editing table data in ASP.NET
      • Browser history support
    • ADO.NET Data Services
      • Create REST addressable services endpoints for your data and consume with AJAX and Silverlight
    • Silverlight Controls for ASP.NET
      • Integrate Silverlight into ASP.NET applications
  • 22. ASP.NET Dynamic Data
    • Create quickly a rich data-driven Web sites
      • Like in Ruby on Rails and Django (in Python)
      • Based on LINQ to SQL data model
      • Dynamically display data based on the data model of the underlying database
      • Pages are created automatically (zero code)
    • Based on highly customizable templates
    • Uses dynamic data fields – user controls that render standard data field types
  • 23. ASP.NET Dynamic Data
  • 24. ASP.NET AJAX
    • All AJAX 1.0 features in .NET 3.5
      • Enhancements to UpdatePanel
      • WCF JSON Services
    • Better Development Experience
      • JavaScript Intellisense
      • JavaScript Debugging
      • ASP.NET AJAX Extender Control Support
    ASP.NET 2.0 VS 2005 v1.0 ASP.NET 3.5 VS 2008 v1.0 v3.5
  • 25. ASP.NET AJAX Control Toolkit
    • Separate download from core ASP.NET AJAX
      • Library of free ASP.NET AJAX enabled controls
      • Download from http:// ajax.asp.net
    • Developed using a collaborative source model
      • Licensed under Microsoft Public License (Ms-PL)
      • All source freely available
    • ~ 40 controls as of today