Bienvenidos.

1 Bienvenidos ...
Author: Emilia Soler Agüero
0 downloads 0 Views

1 Bienvenidos

2 Language Integrated Query – LINQ: Nuevos paradigmas en el acceso a datosOscar J. Berroterán MCP, MVP Visual Basic,Ineta Academic Speaker, MS Andean Speaker Group

3 Agenda Pasado, presente y futuro Objetivos Presentando LINQ Demos

4 .Net a través del tiempo 2002 2003 2005 2006 2008¿? Tool(Visual Studio) VS .NET 2002 VS .NET 2003 VS .NET 2005 + Extensiones (WPF, WWF,..) Visual Studio 2008 Codename Orcas Lenguajes C# v1 VB .Net v7 C# v1.1 VB .Net v7.1 C# v2 VB 2005 (v8) C# v3 VB .9 Framework NetFx v1.0 NetFx v1.1 NetFx v2.0 NetFx v3.0 NetFx v3.5 Engine (CLR) CLR v1.0 CLR v1.1 CLR v2.0 ¿?

5 Evolución de acceso a datos en .NetWPF,WCF, WWF .Net 3.0 .Net 2.0 Generics ADO .Net Factory objects .Net 1.0 ADO .Net , Datasets (desconectado), Componentes administrados

6 El concepto … “El concepto LINQ es la idea de aportar al .Net Framework la capacidad de creación, generación y ejecución de un modelo de consulta sobre cualquier tipo de información en memoria.” Datos Objetos != Orientación a objeto, polimorfismo, interfaces, herencia… Proyecciones, agrupaciones, claves foráneas, joins…

7 Objetivos de LINQ Integración de datos Adicional ObjetosDatos Relacionales XML Adicional Mejorar la consistencia de los lenguajes Añadir funcionalidad No atar el lenguaje a un API especifico Mantener la compatibilidad hacia atras

8 Objetivos de LINQ Simplificar la búsqueda de informaciónIntegrar búsquedas y transformaciones Unificar el proceso de búsqueda en diferentes fuentes de información Simplificar el trabajo con XML Producir docs. XML rápidamente Accecer a los miembros de un doc. XML fácilmente

9 mmm, ¿Cómo? Sintaxis LINQ From C in ClientesWhere c.Ciudad = “Maracay” Select new { c.Nombre, c.Apellido}; Sintaxis SQL Select C.Nombre, c.Apellido from Clientes As c where c.Ciudad=“Maracay”;

10 Presentando Language Integrated Query (LINQ)C# VB Others… .Net Language Integrated Query (LINQ) LINQ enabled data sources LINQ to ADO.NET LINQ To Objects LINQ To Datasets LINQ To SQL LINQ To Entities LINQ To XML </span> <span class='tr'><author/ rel="nofollow"></span> <span class='tr'><price/></span> <span class='tr'></book></span> <span class='tr'>Objects</span> <span class='tr'>XML</span> <span class='tr'>Relational</span></p><p><span class="span-circle-num"> 11 </span> ¿Que hay detrás de esto? Mejoras del lenguaje = L I N Q<span class='tr'>(Inferencia de tipos</span> <span class='tr'>Inicializadores de objetos</span> <span class='tr'>Tipos anónimos</span> <span class='tr'>Expresiones Lambda (funciones en línea)</span> <span class='tr'>Extension Methods)</span> <span class='tr'>+ Query Expressions</span> <span class='tr'>= L I N Q</span></p><p><span class="span-circle-num"> 12 </span> Sintaxis From id in Source {From id in Source|<span class='tr'>Cero o más From, join, let, where u orderby</span> <span class='tr'>Comienza con From</span> <span class='tr'>From id in Source</span> <span class='tr'>{From id in Source|</span> <span class='tr'>Join id in Source on expr equals expr</span> <span class='tr'>[into id]|</span> <span class='tr'>Let id = expr| where condition |</span> <span class='tr'>Orderby ordering, ordering,…}</span> <span class='tr'>Select expr | group expr by key</span> <span class='tr'>Into idquery</span> <span class='tr'>Termina con Select o groupby</span> <span class='tr'>Continuación opcional into</span></p><p><span class="span-circle-num"> 13 </span> Local Variable Type Inference<span class='tr'>El tipo de la variable se determina del proceso de inicialización</span> <span class='tr'>Dim i=666</span> <span class='tr'>Dim s = “UCAB”</span> <span class='tr'>Dim d = 3.14</span> <span class='tr'>Dim numbers = new int() {1,2,3,4}</span></p><p><span class="span-circle-num"> 14 </span> Object Initializers Dim oPunto as Punto = New Punto oPunto.X=10<span class='tr'>Public Class Punto</span> <span class='tr'>Private mX as integer</span> <span class='tr'>Private mY as integer</span> <span class='tr'>Public Property X as Integer</span> <span class='tr'>Get</span> <span class='tr'>Return mX</span> <span class='tr'>end get</span> <span class='tr'>Set (ByVal value as Integer)</span> <span class='tr'>mX=value</span> <span class='tr'>end Set</span> <span class='tr'>End Property</span> <span class='tr'>End Class</span> <span class='tr'>Dim oPunto as Punto = New Punto</span> <span class='tr'>oPunto.X=10</span> <span class='tr'>oPunto.Y=20</span> <span class='tr'>Dim Opunto as Point = New Point With {.X=10, .Y=20}</span></p><p><span class="span-circle-num"> 15 </span> <span>Lambda Expresions</span> <span class='tr'>Una expresión lambda es una función sin nombre que calcula y devuelve un solo valor. Las expresiones lambda se pueden utilizar dondequiera que un tipo del delegado sea válido.</span> <span class='tr'>Método</span> <span class='tr'>Clase real</span> <span class='tr'>X=Paises.GetAll.Where(Function (a as Paises) a.Id =1)</span> <span class='tr'>Ext. Method</span></p><p><span class="span-circle-num"> 16 </span> <span>Anonymous Types</span> <span class='tr'>Class XXX</span> <span class='tr'>Public Nombre as String</span> <span class='tr'>Public Tipo as Integer</span> <span class='tr'>End Class</span> <span class='tr'>XXX</span> <span class='tr'>Dim OCliente = New With {.Nombre=“Oscar”, .Tipo=20}</span></p><p><span class="span-circle-num"> 17 </span> <span>12/7/2017 4:44 AM</span> <span class='tr'>Extension Methods</span> <span class='tr'>Los métodos de extensión permiten, a partir de la creación de clases, extender tipos existentes con nuevas funcionalidades (métodos).</span> <span class='tr'>En VB9 sólo estan permitidos a nivel de módulos</span> <span class='tr'><System.Runtime.CompilerServices.Extension()> _ Public Function Concatenar(ByVal values as Ienumerable(of Integer), ByVal separador as String) as String</span> <span class='tr'>Dim st as String = String.Empty</span> <span class='tr'>For Each i as Integer in Values</span> <span class='tr'>st= st + i.ToString + separador</span> <span class='tr'>next</span> <span class='tr'>return st</span> <span class='tr'>End Function</span> <span class='tr'>© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.</span> <span class='tr'>The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.</span></p><p><span class="span-circle-num"> 18 </span> demo Linq to Objects 12/7/2017 4:44 AM<span class='tr'>© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.</span> <span class='tr'>The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.</span></p><p><span class="span-circle-num"> 19 </span> Language INtegrated Query<span class='tr'>12/7/2017 4:44 AM</span> <span class='tr'>Language INtegrated Query</span> <span>C#</span> <span>VB</span> <span class='tr'>Others…</span> <span class='tr'>.Net Language Integrated Query (LINQ)</span> <span class='tr'>LINQ enabled data sources</span> <span class='tr'>LINQ enabled ADO.NET</span> <span class='tr'>LINQ</span> <span class='tr'>To Objects</span> <span class='tr'>LINQ</span> <span class='tr'>To Datasets</span> <span class='tr'>LINQ</span> <span class='tr'>To SQL</span> <span class='tr'>LINQ</span> <span class='tr'>To Entities</span> <span class='tr'>LINQ</span> <span class='tr'>To XML</span> <span class='tr'><book></span> <span class='tr'><title/></span> <span class='tr'><author/ rel="nofollow"></span> <span class='tr'><price/></span> <span class='tr'></book></span> <span class='tr'>Objects</span> <span class='tr'>XML</span> <span class='tr'>Relational</span> <span class='tr'>© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.</span> <span class='tr'>The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.</span></p><p><span class="span-circle-num"> 20 </span> <span>12/7/2017 4:44 AM</span> <span class='tr'>demo</span> <span class='tr'>Linq to SQL</span> <span class='tr'>© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.</span> <span class='tr'>The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.</span></p><p><span class="span-circle-num"> 21 </span> Recursos Visual Studio 2008 LINQ Forum LINQ project<span class='tr'>12/7/2017 4:44 AM</span> <span class='tr'>Recursos</span> <span class='tr'>Visual Studio 2008</span> <span></span> <span class='tr'>LINQ Forum</span> <span class='tr'>teID=1</span> <span class='tr'>LINQ project</span> <span></span> <span class='tr'>Blogs</span> <span></span> <span></span> <span></span> <span></span> <span class='tr'>© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.</span> <span class='tr'>The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.</span></p><p><span class="span-circle-num"> 22 </span> <span>12/7/2017 4:44 AM</span> <span class='tr'>GRACIAS !!!</span> <span class='tr'>© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.</span> <span class='tr'>The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.</span></p> </div> </div> </div> </div> </div> </div> </div> <script src='https://www.google.com/recaptcha/api.js'></script> <!-- Box Modal --> <div class="modal fade" id="login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close" on="tap:login.close"><span aria-hidden="true">×</span></button> <h3 class="modal-title">Sign In</h3> </div> <div class="modal-body"> <form action="https://slidepptx.com/login" method="post"> <div class="form-group form-group-lg"> <label class="sr-only" for="email">Email</label> <input class="form-input form-control" type="text" name="email" id="email" value="" placeholder="Email" /> </div> <div class="form-group form-group-lg"> <label class="sr-only" for="password">Password</label> <input class="form-input form-control" type="password" name="password" id="password" value="" placeholder="Password" /> </div> <div class="form-group form-group-lg"> <div class="checkbox"> <label class="form-checkbox"> <input type="checkbox" name="remember" value="1" /> <i class="form-icon"></i> Remember Password </label> <label class="pull-right"><a href="https://slidepptx.com/forgot">Forgot Password?</a></label> </div> </div> <button class="btn btn-lg btn-primary btn-block" type="submit">Sign In</button> </form> <hr style="margin-top: 15px;" /> <a href="https://slidepptx.com/login/google" class="btn btn-lg btn-google btn-block"><i class="fa fa-google"></i> Login with Google</a> </div> </div> </div> </div> <!-- Box Footer --> <div class="footer-container" style="background: #fff;display: block;padding: 10px 0 20px 0;margin-top: 30px;"> <div class="footer-container-inner"> <footer id="footer" class="container"> <div class="row"> <div class="bottom-footer"> <div class="container"> Copyright © 2026 SLIDEPPTX.COM. All rights reserved. </div> <hr /> </div> </div> <div class="row"> <!-- Block footer --> <section class="block col-md-4 col-xs-12 col-sm-3" id="block_various_links_footer"> <h4>Information</h4> <ul class="toggle-footer" style=""> <li><a href="https://slidepptx.com/about">About Us</a></li> <li><a href="https://slidepptx.com/privacy">Privacy Policy</a></li> <li><a href="https://slidepptx.com/term">Terms and Conditions</a></li> <li><a href="https://slidepptx.com/copyright">Copyright</a></li> <li><a href="https://slidepptx.com/contact">Contact Us</a></li> </ul> </section> <!-- /Block footer --> <section id="social_block" class="col-md-4 col-xs-12 col-sm-3 block"> <h4>Follow us</h4> <ul> <li class="facebook"> <a target="_blank" href="" title="Facebook"> <i class="fa fa-facebook-square"></i> <span>Facebook</span> </a> </li> <li class="twitter"> <a target="_blank" href="" title="Twitter"> <i class="fa fa-twitter-square"></i> <span>Twitter</span> </a> </li> <li class="google-plus"> <a target="_blank" href="" title="Google Plus"> <i class="fa fa-plus-square"></i> <span>Google Plus</span> </a> </li> </ul> </section> <!-- Block Newsletter module--> <div id="newsletter" class="col-md-4 col-xs-12 col-sm-3 block"> <h4>Newsletter</h4> <div class="block_content"> <form action="https://slidepptx.com/newsletter" method="post"> <div class="form-group"> <input id="newsletter-input" type="text" name="email" size="18" placeholder="Entrer Email" /> <button type="submit" name="submit_newsletter" class="btn btn-default"> <i class="fa fa-location-arrow"></i> </button> <input type="hidden" name="action" value="0"> </div> </form> </div> </div> <!-- /Block Newsletter module--> </div> </footer> </div> </div> <!-- #footer --> <script> $(function () { $("#document_search").autocomplete({ source: function (request, response) { $.ajax({ url: "https://slidepptx.com/suggest", dataType: "json", data: { term: request.term }, success: function (data) { response(data); } }); }, autoFill: true, select: function (event, ui) { $(this).val(ui.item.value); $(this).parents("form").submit(); } }); }); $(document).ready(function() { $(".doc-share-btn").click(function() { var urlshare = $(this).attr('data-share-url'); window.open('http://www.facebook.com/sharer.php?u=' + urlshare, '_blank'); }); }); function download_submit() { $('#download_form').submit(); } </script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-106734935-2', 'auto'); ga('send', 'pageview'); </script> </body> </html>