Re Descubriendo A Linq

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    Re Descubriendo A Linq - Presentation Transcript

    1. Re-descubriendo LINQ Jose Fco Bonnin Payvision Blog: http://www.josefcobonnin.com
    2. Agenda
      • Historia
      • LINQ Basics
      • LINQ to XML
      • LINQ to SQL
    3. LINQ Overview C# 3.0 VB 9.0 Otros… LINQ to SQL LINQ to XML LINQ to DataSets .NET Language Integrated Query LINQ to Objects LINQ to Entities LINQ to Whatever Objetos Datos relacionales <book> <title/> <author/> <year/> <price/> </book> XML
    4. Demo
      • LINQ
    5. Historia
      • OR/M
        • Finales 2000 - Cheops
        • 2001 PDC – Presentación ObjectSpaces
      • Evolución Lenguaje
        • 2001 BillG Thinkweek – XML Types for C#
        • 2002 XML Conference - X#
        • 2002 Microsoft Research – Polyphonic C#
        • 2003 XML Conference - Xen
        • 2004 Microsoft Research – C ω
      • 2005 PDC - Presentación oficial de LINQ
    6. My First Query
      • int[] numbers = { 5, 10, 8, 3, 6, 12 };
      • IEnumerable<int> myFirstQuery = Enumerable.Where(numbers, num => num > 6);
      • myFirstQuery =
      • Enumerable.OrderBy(myFirstQuery, n => n);
      • foreach (int i in myFirstQuery)
      • {
      • Console.WriteLine(i);
      • }
    7. Standard Query Operators I Agrupados por tipo de Operación
      • Sorting
        • OrderBy
        • ThenBy
        • OrderByDescending
      • Aggregation
        • Aggregate
        • Average
        • Count
        • LongCount
      • Grouping
        • GroupBy
        • ToLookUp
      • Projection
        • Select
        • SelectMany
    8. Standard Query Operators II Agrupados por tipo de Ejecución
      • Immediate
        • Aggregate
        • Any
        • Average
        • First
      • Deferred - Streaming
        • Cast
        • Distinct
        • Select
        • Where
      • Deferred – Non Streaming
        • GroupBy
        • Join
        • OrderBy
    9. Demo
      • Immediate and Deferred Execution
    10. Query Expressions Syntax I
      • from-clause:
      • from [Type] identifier in expression [join clauses]
      • i.e from num in new int[] {1, 2, 3, 4}
      •  
      • join clause:
      • join [Type] identifier in expression on expression equals expression
    11. Query Expressions Syntax II
    12. Query Expression
      • var a = from p in people
            • where p.Age > 15
      • orderby p.Name, p.Age descending
      • select new { p.Name, p.Surname};
      Implicitly Typed Variables Extension Methods Lambda Expression Object Initializer Anonymous Type var a = people.Where(p => p.Age > 15) .OrderBy (p => p.Name) .ThenByDescending(p => p.Age) .Select(p => new p.Name, p.Surname);
    13. Demo
      • Query Expressions
    14. “ PRE” LINQ to XML – W3C DOM XML
      • XmlDocument xmlDoc = new XmlDocument();
      • XmlElement freaks = xmlDoc.CreateElement(&quot;Freaks&quot;);
      • xmlDoc.AppendChild(freaks);
      • XmlElement freak = xmlDoc.CreateElement(&quot;Freak&quot;);
      • XmlAttribute freakType = xmlDoc.CreateAttribute(&quot;Speciality&quot;);
      • freakType.InnerText = “TFS&quot;;
      • freak.Attributes.Append(freakType);
      • XmlElement name = xmlDoc.CreateElement(&quot;Name&quot;);
      • name.InnerText = &quot;Luis&quot;;
      • freak.AppendChild(name);
      • XmlElement surname = xmlDoc.CreateElement(&quot;Surname&quot;);
      • surname.InnerText = &quot;Fraile&quot;;
      • freak.AppendChild(surname);
      <Freaks> <Freak Specialty=&quot;TFS&quot;> <Name>Luis</Name> <Surname>Fraile</Surname> </Freak> </Freaks>
    15. “ PRE” LINQ to XML – XML “Lite”
      • string xml =
      • “ <Freaks>
      • <Freak Specialty=&quot;{0}&quot;><Name>{1}</Name><Surname>{2}</Surname></Freak>
      • </Freaks>”;
      • string formattedXml = string.Format(xml, &quot;TFS&quot;, &quot;Luis&quot;, &quot;Fraile&quot;);
    16. LINQ to XML
    17. Demo
      • LINQ to XML
    18. Expression Trees
      • Expression<Func<int,int,int>> exp = (a,b) => a + b
      • ParameterExpression left = Expression.Parameter(typeof(int), &quot;a&quot;);
      • ParameterExpression right= Expression.Parameter(typeof(int), &quot;b&quot;);
      • BinaryExpression body = Expression.Add(left, right);
      • Expression expression = Expression.Lambda(body, left, right);
      Add a b Left Right Body
    19. Demo
      • LINQ to SQL != Transact/SQL
    20. LINQ to SQL
      • ¿Sólo para RAD?
      • Service Oriented Architecture, ¿Se puede o no?
      • LINQ to SQL o Entity Framework
    21. Demo
      • LINQ to SQL
    22. Fin
      • this.Dispose();
    23. Referencias
      • C# 3.o Specification
      • http://msdn.microsoft.com/en-us/library/ms364047(VS.80).aspx
      • The LINQ Project:
      • http://msdn.microsoft.com/en-us/netframework/aa904594.aspx
      • Standard Query Operators
      • http://download.microsoft.com/download/5/8/6/5868081c-68aa-40de-9a45-a3803d8134b8/Standard_Query_Operators.doc
      • 101 Linq Samples
      • http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx
      • Jose Blog:
      • http://www.josefcobonnin.com

    + jfbonninjfbonnin, 2 years ago

    custom

    377 views, 1 favs, 1 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 377
      • 344 on SlideShare
      • 33 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 0
    Most viewed embeds
    • 33 views on http://www.josefcobonnin.com

    more

    All embeds
    • 33 views on http://www.josefcobonnin.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags