Presentation is loading. Please wait.

Presentation is loading. Please wait.

Beth Massi Program Manager Visual Studio Community.

Similar presentations


Presentation on theme: "Beth Massi Program Manager Visual Studio Community."— Presentation transcript:

1 Beth Massi Program Manager Visual Studio Community

2 PM on the VS Community team @ Microsoft VB Community Champion! Working directly with the VB team Provide content production and management for the VB Dev Center http://msdn.com/vbasic http://msdn.com/vbasic Ex-Microsoft Architect MVP Ex-.NET Systems Architect / Lead Programmer at various healthcare companies and consulting firms Over 13 years of information systems experience http://blogs.msdn.com/bethmassi

3 Simplify querying data Integrate query and transform operations Unify query of object, relational, and XML data Simplify working with XML Impose structure on XML w/no schema Produce XML documents quickly Access XML members easily

4 Visual Basic 9 & the XML Data Type XML Literals XML Properties LINQ to XML API Mapping the XML Data Type to the LINQ to XML API Creating, Querying, Transforming XML in VB Evolution Away from the DOM XML Properties and Enabling IntelliSense Miscellaneous tips and tricks …Be the most productive when programming against XML

5 LINQ enabled data sources LINQ To Objects Objects LINQ To XML XML LINQ enabled ADO.NET LINQ To Datasets LINQ To SQL LINQ To Entities Relational Others… VB C#.NET Language-Integrated Query

6

7 Dim doc As New XmlDocument() Dim contacts As XMLElement = doc.CreateElement("contacts") For Each cust in Customers If (cust.Country = "USA") Dim e As XMLElement = doc.CreateElement("contact") Dim name As XMLElement = doc.CreateElement("name") name.InnerText = c.CompanyName e.AppendChild(name) Dim phone As XMLElement = doc.CreateElement("phone") phone.InnerText = cust.Phone e.AppendChild(phone) contacts.AppendChild(e) End If Next doc.AppendChild(contacts) <contacts> Great Lakes Food Great Lakes Food (503) 555-7123 (503) 555-7123 …</contacts> Imperative model Document- centric No integrated queries Memory- intensive

8 Dim contacts As New XElement("contacts", _ From cust in customers _ Where cust.Country = "USA“ _ Select New XElement("contact", _ New XElement("name", cust.CompanyName), _ New XElement("phone", cust.Phone) _ ) Declarative model Element- centric Integrated queries Smaller and faster

9 Language integrated query for XML Expressive power of XPath/Xquery But with Visual Basic as your programming language No conceptual barrier between XML and code Leverages experience with DOM Element-centric, not document-centric Symmetry in element/attribute APIs Functional construction Text nodes are just strings Simplified XML namespace support Faster and smaller than DOM

10

11 Dim contacts = _ <%= _ From cust In customers _ Where cust.Country = "USA" _ Select _ %> Infers Xml.Linq XElementInfers Xml.Linq XElement No conceptual barrier WYSIWYG! Expression holes for computed values

12 Shorthand for object creation Dim emp = _ Joe 28 Engineering Dim emp = _ New XElement("employee", _ New XElement("name", "Joe"), _ New XElement("age", 28), _ New XElement("department", _ New XElement("name", "Engineering"), _ New XAttribute("id", 432)))

13

14 Element access covers all XML axes Dim employees As XElement = GetCurrentEmployeesByDept(“IT”) Dim deptID As Integer = employees.Attribute(“DeptID") Dim emp As XElement = employees.Descendents(“Employee")(0) Dim empDOB As Date = emp.Element(“DateOfBirth“).Value Dim employees As XElement = GetCurrentEmployeesByDept(“IT”) Dim deptID As Integer = employees.@DeptID Dim emp As XElement = employees… (0) Dim empDOB As Date = emp..Value Attributes Descendents Elements Nancy Davolio Nancy Davolio Sales Representative Sales Representative 1948-12-08 1948-12-08 Andrew Fuller Andrew Fuller Vice President, Sales Vice President, Sales 1952-02-19 1952-02-19 </Employees>

15

16

17 Download Beta 2! http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx RTM = End of Nov! (very soon) LINQ How-To Videos http://msdn2.microsoft.com/en-us/vbasic/bb466226.aspx#linq Blogosphere/Community: VB Dev Center: http://msdn.com/vbasichttp://msdn.com/vbasic VB Team: http://blogs.msdn.com/vbteamhttp://blogs.msdn.com/vbteam Beth Massi: http://blogs.msdn.com/bethmassihttp://blogs.msdn.com/bethmassi Paul Vick: http://www.panopticoncentral.nethttp://www.panopticoncentral.net

18 ©2007 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.


Download ppt "Beth Massi Program Manager Visual Studio Community."

Similar presentations


Ads by Google