Oreilly.Programming.Dot.NET.3.5

Oreilly.Programming.Dot.NET.3.5

Programming .NET 3.5 Other Microsoft .NET resources from O’Reilly Related titles .NET Windows Forms in a Building a Web 2.0 Portal Nutshell with ASP.NET 3.5 ADO.NET 3.5 Cookbook™ Learning ASP.NET 3.5 ADO.NET 3.5 in a Nutshell Programming ASP.NET AJAX .NET Books dotnet.oreilly.com is a complete catalog of O’Reilly’s books on Resource Center .NET and related technologies, including sample chapters and code examples. ONDotnet.com provides independent coverage of fundamental, interoperable, and emerging Microsoft .NET programming and web services technologies. Conferences O’Reilly brings diverse innovators together to nurture the ideas that spark revolutionary industries. We specialize in document- ing the latest tools and systems, translating the innovator’s knowledge into useful skills for those in the trenches. Visit conferences.oreilly.com for our upcoming events. Safari Bookshelf (safari.oreilly.com) is the premier online refer- ence library for programmers and IT professionals. Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions in a matter of seconds. Read the books on your Bookshelf from cover to cover or sim- ply flip to the page you need. Try it today for free. Programming .NET 3.5 Jesse Liberty and Alex Horovitz Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo Programming .NET 3.5 by Jesse Liberty and Alex Horovitz Copyright © 2008 Jesse Liberty and Alex Horovitz. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (safari.oreilly.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Editor: John Osborn Indexer: Ellen Troutman Zaig Production Editor: Rachel Monaghan Cover Designer: Karen Montgomery Copyeditor: Rachel Head Interior Designer: David Futato Proofreader: Rachel Monaghan Illustrator: Jessamyn Read Printing History: July 2008: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Programming .NET 3.5, the image of a giant petrel, and related trade dress are trademarks of O’Reilly Media, Inc. Java™ is a trademark of Sun Microsystems, Inc. .NET is a registered trademark of Microsoft Corporation. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. This book uses RepKover™, a durable and flexible lay-flat binding. ISBN: 978-0-596-52756-3 [M] This book is dedicated to the simple idea of human respect, which entails the incredibly difficult process of actually listening to one another with an open mind. —Jesse Liberty To my spouse, Torri, and my three boys, Daniel, Zachary, and Jason. Together our adventure continues. Each day brings new opportunities and the chance to build on the accomplishments of the day before. Never stop living to make today the best day of your life. —Alex Horovitz Table of Contents Preface . xi Part I. Presentation Options 1. .NET 3.5: A Better Framework for Building MVC, N-Tier, and SOA Applications . 3 Integration Versus Silos 4 What? All That in One Book? 5 2. Introducing XAML: A Declarative Way to Create Windows UIs . 7 XAML 101 8 Simple XAML Done Simply 10 Over Here…No, Wait, I Meant Over There! 23 It’s Alive! (Or, How I Learned to Stop Worrying and Love Animation) 32 3. Introducing Windows Presentation Foundation: A Richer Desktop UI Experience . 45 Starting Simple: Panels 46 Nesting 65 Resources 67 Transformations 68 Animation 69 Data Binding 76 vii 4. Applying WPF: Building a Biz App . 89 Breaking the Application into Pieces 90 Adorners 90 Business Classes 95 Page 1—Adding Items to the Shopping Cart 99 Page 2—Validating the Credit Card 124 5. Introducing AJAX: Moving Desktop UIs to the Web . 137 Web Applications Just Got a Whole Lot Faster 137 Getting Started 139 Creating a “Word Wheel” with AJAX 141 ScriptManager 151 What’s Next? 160 6. Applying AJAX: ListMania . 161 Creating the To-Do List Manager 161 Personalizing the To-Do List 180 7. Introducing Silverlight: A Richer Web UI Platform . 195 Silverlight in One Chapter 195 The Breadth of Silverlight 196 Diving Deep: Building an Application 196 Controls 197 Events and Event Handlers 207 Creating Controls Dynamically 212 Data Binding 215 Styling Controls 221 Part II. Interlude on Design Patterns 8. Implementing Design Patterns with .NET 3.5 . 227 .NET 3.5 Fosters Good Design 228 The N-Tier Pattern 231 The MVC Pattern 232 The Observer Pattern/Publish and Subscribe 249 The Factory Method Pattern 258 The Chain-of-Command Pattern 266 The Singleton Pattern 274 viii | Table of Contents Part III. The Business Layer 9. Understanding LINQ: Queries As First-Class Language Constructs . 283 Defining and Executing a LINQ Query 284 Extension Methods 297 Adding the AdventureWorksLT Database 305 LINQ to SQL Fundamentals 308 Using the Visual Studio LINQ to SQL Designer 313 Retrieving Data 317 LINQ to XML 322 10. Introducing Windows Communication Foundation: Accessible Service-Oriented Architecture . 327 Defining a Service More Precisely 328 Implementing Web Services 332 UDDI: Who Is Out There, and What Can They Do for Me? 337 How It All Works 338 WCF’s SOA Implementation 339 Putting It All Together 343 11. Applying WCF: YahooQuotes . 346 Creating and Launching a Web Service 346 Consuming the Web Service 355 12. Introducing Windows Workflow Foundation . 365 Conventional (Pre-WF) Flow Control 365 Using Windows Workflow 371 Understanding the WF Runtime 383 Workflow Services 383 13. Applying WF: Building a State Machine . 386 Windows Workflow and State Machines 387 Building an Incident Support State Machine 387 14. Using and Applying CardSpace: A New Scheme for Establishing Identity . 408 About Windows CardSpace 409 Creating a CardSpace Identity 413 Adding CardSpace Support to Your Application 418 Summary 435 Table of Contents | ix Epilogue . 437 Index . 439 x | Table of Contents Preface1 This book tells the story of .NET 3.5. We will not try to sell you on why .NET 3.5 is great, why it will make you more productive, why you should learn it, why your company should invest in incorporating this new technology, and so on. Microsoft has lots of folks selling .NET 3.5, and they are quite good at their jobs, so we’ll leave that to them. Nor will we regurgitate the Microsoft documentation; you can get that for free on the Internet. Finally, while we hope you will return to this book often and keep it on your desk as a useful reference, our goal is not to provide a compendium, but simply to introduce you to .NET 3.5, speaking as one programmer to another. In the early days of personal computing, the hard part was finding the information you needed, because so little was published. Today, the hard part is separating the nuggets of wheat from the mountains of chaff. There is a blizzard of information out there (books, articles, web sites, blogs, videos, podcasts, sky writing...), but the signal- to-noise ratio approaches zero (while the metaphors are beginning to pile up under your feet!). Our aim is to provide you with the key information you need, together with a context for that information: a scaffolding into which you can fit what you learn to make you more productive and to make your programs better. It is our belief that .NET 3.5 in general, and Silverlight in particular, will change pro- gramming more significantly than anything that has come from Microsoft for at least a decade. The advent of .NET 3.5 marks a turning point in how we approach programming— one we embrace with great enthusiasm. From one perspective, .NET 3.5 is nothing more than a collection of disparate technologies: • Windows Presentation Foundation (WPF) for writing Windows applications • Silverlight for delivering Rich Internet Applications (RIAs) via the Web, across browsers and platforms • Windows Communication Foundation (WCF) for creating contract-based web services and implementing Service-Oriented Architectures (SOAs) • Windows Workflow Foundation (WF) for defining the workflow in an application xi • CardSpace for creating user-negotiated identities on the Web • ASP.NET/AJAX for rich-client web applications You can expect to see many books that treat each of these technologies individually, but in this book we have instead chosen to take an integrated approach. This book has two goals. The first, as we have intimated, is to tell the real story of .NET 3.5, rather than simply repeating what you can find in the documentation. We will pro- vide the essential information that you need to make solid, practical, reliable use of all of the technologies we’ve just mentioned, while providing a clear picture of which problems each of the technologies solves, either alone or working with others. The second goal is to show that, rather than truly being a collection of isolated tech- nologies, the various parts of .NET 3.5 can be stitched together into a coherent whole with a pair of common themes: • .NET 3.5 fosters the development of better-architected applications (leveraging MVC, n-tier, SOA, and other industry-tested patterns).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    478 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us