Download presentation
Presentation is loading. Please wait.
Published byApril Merritt Modified over 9 years ago
2
Eric White Technical Evangelist Microsoft Corporation Session Code: OFC403
3
REDUCE # LINES OF CODE
4
Actually, it's about reducing Cyclomatic Complexity But Why?
5
REDUCE POINTS OF POSSIBLE FAILURE (More robust code)
6
Session Objectives and Takeaways Session Objective(s): Benefits of “Pure FP” 3 Approaches: LINQ / Open XML Tools and Resources
7
It's All About Transformations Projection Composability Purity Tuples Aggregation
8
More FP Extension Methods Lazy Evaluation Closures Method Syntax
9
Open XML Zip Files (called Packages) Packages contain Parts (files in the Zip file) Package has relationship to Parts Parts have relationship to other Parts Content Type tells what the XML is PowerTools for Visual Studio Rock! Open XML Diff is your friend
10
Open XML SDK V1 Strongly Typed access to Parts No help with the XML V2 Strongly Typed access to Xml Validation Helper Functions
11
LtxOpenXml Class XDocument Annotations on Parts Extension methods on MainDocumentPart Lazy Projects collections of Named Tuple Types
12
LINQ to XML Tips Pre-atomize XName and XNamespace Use Extension methods to find optional Elements/Attributes
13
LINQ to Excel Tables Use friendly names of Tables and Columns Based on LtxOpenXml Class Lazy
14
Modifying XML Trees “Halloween Problem” Accept Revisions Remove Personal Information Remove Comments See OpenXmlInfo class on my blog
15
Annotations / Events Use Annotations and Events to determine if tree changed Can implement “Flush” – get list of all parts
16
In-Memory Open XML Documents Web application servers SharePoint SharePoint Web Services
17
Transforming in XSLT Style Annotate the tree with new nodes Query to find nodes == XPath pattern Replacement node == Sequence Constructor ApplyTransforms node == xsd:apply-templates Example uses extension methods to reduce syntactic noise Supports Mode
18
Recap: Three Approaches 1)Pure Functional Transforms 2)“Imperative” Document Modification 3)XSLT Style
19
DocProc An “imperative” approach to document assembly Part of PowerTools for Open XML Project Alternative to altChunk
20
Document Reflector “Build a document assembly solution in 5 minutes” Functional Construction in “Expression Context”
21
Open XML Code Tester Content Controls are Key Uses Title of Content Control Puts XML in Content Controls
22
Next Steps Go through the Functional Programming Tutorial Download, run the samples Modify them for your scenario Get involved in the community
24
Key Resources Open XML SDK V1 http://go.microsoft.com/fwlink/?LinkId=120908 Open XML SDK V2 http://go.microsoft.com/fwlink/?LinkId=127912 MSDN Contains how-to articles and documentation Forums related to SDK http://msdn.microsoft.com/office/xml
25
Key Resources Connect Access to more articles and forums Ability to log bugs and vote for features http://connect.microsoft.com
26
Key Resources Blogs blogs.msdn.com/ericwhite blogs.msdn.com/brian_jones blogs.msdn.com/dmahugh PowerTools for Visual Studio http://www.microsoft.com/downloads/details.aspx ?FamilyId=46B6BF86-E35D-4870-B214- 4D7B72B02BF9&displaylang=en PowerTools for Open XML www.codeplex.com/powertools
27
www.microsoft.com/teched Sessions On-Demand & Community http://microsoft.com/technet Resources for IT Professionals http://microsoft.com/msdn Resources for Developers www.microsoft.com/learning Microsoft Certification and Training Resources www.microsoft.com/learning Microsoft Certification & Training Resources Resources
28
Complete an evaluation on CommNet and enter to win! Required Slide
29
© 2009 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. Required Slide
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.