visual studio 2008 linq

Uploaded from authorPOINTLite
Views:
 
Category: Entertainment
     
 

Presentation Description

No description available.

Comments

By: velmurugan55555 (14 month(s) ago)

Hai, i referred your LInq Presententaion. It is quite good. please give me the permisssion to download it,. Thanks

By: thyshiva (33 month(s) ago)

Hai, i referred your LInq Presententaion. It is quite good. please give me the permisssion to download it,. Thanks, Thyag
u.

Presentation Transcript

Slide1: 

Julián Enrique Verdezoto Celi

Slide2: 

Conceptos Generales LINQ en objetos DEMO LINQ y XML DEMO LINQ y SQL DEMO

Slide3: 

LINQ (Language Integrated Query) API de C# 3.0 focalizada en el acceso a datos. Múltiples origenes de datos. Extensibilidad SQL, XML y Objetos. Facilita relación datos objetos

Slide4: 

Integración nativa con los lenguajes que facilitan la productividad y la detección de errores (Validación Sintáctica). Tipado anónimo para proyecciones en todo tipo de colecciones. Fuertemente Tipado.

Slide5: 

Operadores de consulta pueden usarse en cualquier colección. Select, from, where, group by, join, etc. Sentencias para ordenamiento de datos.

Slide6: 

OPERADORES DE CONSULTA var numbers = new int[] {1,2,5,8,12,13,14,15,17,21,23}; var results = from c in numbers where (c % 2) == 0 select c;

Slide7: 

SENTENCIAS PARA ORDENAMIENTO static IEnumerable<Estudiante> CrearEstudiantes() { return new List<Estudiante> { new Estudiante { Nombre = "Juan", Carrera = "Derecho" }, new Estudiante { Nombre = "Ana", Carrera = "Sistemas" }, new Estudiante { Nombre = "Jenny", Carrera = "Turismo"} }; } var results = from c in CrearEstudiantes() where c.Carrera == "Sistemas“ orderby c.Nombre ascending select c;

Slide9: 

Posee una API para XML sencilla y rápida. Facilita el trabajo con documentos XML, tanto de entrada como de salida.

Slide10: 

XML consultas var doc = XDocument.Load(Server.MapPath("Customers.xml")); var results = from c in doc.Descendants("customer") where c.Element("city").Value == “London" select c;

Slide11: 

XML creación de estructuras XElement transformedResults = new XElement("Clientes", from cust in results select new XElement("Contacto", new XAttribute("ID", cus.Element("id").Value), new XAttribute("Nombre", cus.Element("name").Value), new XAttribute("Ciudad", cus.Element("city").Value), new XAttribute("Pai", cus.Element("country").Value)));

Slide13: 

Mapea una estructura SQL a una clase .Net Traduce una sentencia LINQ a SQL. Soporta operaciones de tipo insert, update y delete. DataContext, BD fuertemente tipadas. Soporte para jerarquías y relaciones. Chequeos en tiempo de compilación.

Slide14: 

LINQ Query Objects SubmitChanges() SQL Query Rows SQL or Stores Procedures

Slide15: 

DLINQ Designer

Slide16: 

Relaciones entre entidades private System.Nullable<long> _VEH_KILOMETRAJE; private string _VEH_COMENTARIO; private EntitySet<VHC_PARTE> _VHC_PARTEs; private EntityRef<VHC_MODELO> _VHC_MODELO; private EntityRef<VHC_PROPIETARIO> _VHC_PROPIETARIO;

Slide17: 

Consulta grvVehiculos.DataSource = from veh in Vehiculos.VHC_VEHICULO join pro in dsPropietarios.VHC_PROPIETARIO on veh.PRP_ID equals pro.PRP_ID join mod in dsMarcas.VHC_MODELO on veh.MOD_ID equals mod.MOD_ID select new { VEH_ID = veh.VEH_ID, MAR_NOMBRE = mod.VHC_MARCARow.Mar_Nombre, MOD_NOMBRE = mod.MOD_NOMBRE, PRP_NOMBRES_APELLIDOS = pro.PRP_NOMBRES_APELLIDOS, VEH_ANIO_FABRICACION = veh.VEH_ANIO_FABRICACION, VEH_COLOR = veh.VEH_COLOR, VEH_CIUDAD = veh.VEH_CIUDAD, VEH_PRECIO = veh.VEH_PRECIO, VEH_KILOMETRAJE = veh.VEH_KILOMETRAJE, EXTRAS = veh.GetVHC_PARTERows().OrderBy(p => p.VHP_PARTE), NUMEXTRAS = veh.GetVHC_PARTERows().Count()};

Slide18: 

Inserción VehiculosDataContext objVeh_DB = new VehiculosDataContext(); VHC_VEHICULO insVehiculo = new VHC_VEHICULO(); insVehiculo.MOD_ID = v.MOD_ID; insVehiculo.PRP_ID = (int)v.PRP_ID; insVehiculo.VEH_COLOR = v.VEH_COLOR; insVehiculo.VEH_CIUDAD = v.VEH_CIUDAD; insVehiculo.VEH_PRECIO = v.VEH_PRECIO; insVehiculo.VEH_KILOMETRAJE = (long)v.VEH_KILOMETRAJE; insVehiculo.VEH_COMENTARIO = v.VEH_COMENTARIO; objVeh_DB.VHC_VEHICULOs.Add(insVehiculo);

Slide19: 

Actualización VehiculosDataContext objVeh_DB = new VehiculosDataContext(); var uptVehiculo = objVeh_DB.VHC_VEHICULOs.Single(p => p.VEH_ID == v.VEH_ID); uptVehiculo.MOD_ID = v.MOD_ID; uptVehiculo.PRP_ID = (int)v.PRP_ID; uptVehiculo.VEH_ANIO_FABRICACION = v.VEH_ANIO_FABRICACION; uptVehiculo.VEH_COLOR = v.VEH_COLOR; uptVehiculo.VEH_CIUDAD = v.VEH_CIUDAD; uptVehiculo.VEH_PRECIO = v.VEH_PRECIO; uptVehiculo.VEH_KILOMETRAJE = (long)v.VEH_KILOMETRAJE; uptVehiculo.VEH_COMENTARIO = v.VEH_COMENTARIO;

Slide20: 

Eliminación VehiculosDataContext objVeh_DB = new VehiculosDataContext(); objVeh_DB.VHC_VEHICULOs.Remove( objVeh_DB.VHC_VEHICULOs.Single( p => p.VEH_ID == v.VEH_ID));

Slide22: 

Soporta las funciones y Stored Procedures.

Slide23: 

Reutilización de SPs objVeh_DB.InsertarMarcas(strNombre, strPais); objVeh_DB.ActualizarMarcas(intMarId, strNombre, strPais);

Slide25: 

http://weblogs.asp.net/scottgu/ msdn2.microsoft.com/netframework/aa904594.aspx www.microsoft.com/spanish/msdn/articulos/archivo/041206/voices/LINQ_Project.mspx blogs.microsoft.co.il/blogs/bursteg/archive/tags/VS2008/default.aspx

Slide26: 

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