Pro ASP.NET 4 CMS: Advanced Techniques for C# Developers Using the .NET 4 Framework ppt

316 951 2
Pro ASP.NET 4 CMS: Advanced Techniques for C# Developers Using the .NET 4 Framework ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

7.5 x 9.25 spine = 0.71875" 320 page count THE EXPERT’S VOICE ® IN .NET Pro ASP.NET 4 CMS Advanced Techniques for C# Developers Using the .NET 4 Framework Alan Harris Learn the latest features of .NET 4 to build powerful ASP.NET 4 web applications Pro this print for content only—size & color not accurate US $42.99 www.apress.com SOURCE CODE ONLINE www.it-ebooks.info www.it-ebooks.info i Pro ASP.NET 4 CMS Advanced Techniques for C# Developers Using the .NET 4 Framework ■ ■ ■ Alan Harris www.it-ebooks.info ii Pro ASP.NET 4 CMS: Advanced Techniques for C# Developers Using the .NET 4 Framework Copyright © 2010 by Alan Harris All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2712-0 ISBN-13 (electronic): 978-1-4302-2713-7 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. President and Publisher: Paul Manning Lead Editor: Ewan Buckingham, Matthew Moodie Technical Reviewer: Jeff Sanders Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Anne Collett Copy Editor: Kim Wimpsett Compositor: MacPS, LLC Indexer: BIM Indexing & Proofreading Services Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders- ny@springer-sbm.com, or visit www.springeronline.com. For information on translations, please e-mail rights@apress.com, or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at www.apress.com. You will need to answer questions pertaining to this book in order to successfully download the code. www.it-ebooks.info iii “What you leave behind is not what is engraved in stone monuments, but what is woven into the lives of others.” —Pericles www.it-ebooks.info iv Contents at a Glance ■Contents at a Glance iv ■Contents v ■About the Author xii ■About the Technical Reviewer xiii ■Acknowledgments xiv ■Introduction xv ■Chapter 1: Visual Studio 2010 and .NET 4 1 ■Chapter 2: CMS Architecture and Development 29 ■Chapter 3: Parallelization 47 ■Chapter 4: Managed Extensibility Framework and the Dynamic Language Runtime 103 ■Chapter 5: jQuery and Ajax in the Presentation Tier 135 ■Chapter 6: Distributed Caching via Memcached 165 ■Chapter 7: Scripting via IronPython 197 ■Chapter 8: Performance Tuning, Configuration, and Debugging 229 ■Chapter 9: Search Engine Optimization and Accessibility 257 ■Index 285 www.it-ebooks.info v Contents ■Contents at a Glance iv ■Contents v ■About the Author xii ■About the Technical Reviewer xiii ■Acknowledgments xiv ■Introduction xv ■Chapter 1: Visual Studio 2010 and .NET 4 1 Who This Book Is For 1 Who This Book Is Not For (or “Buy Me Now, Read Me Later”) 2 What’s New in .NET 4 2 C# Optional and Named Parameters 3 C#’s dynamic Keyword 5 Dynamic and Functional Language Support 10 Parallel Processing 10 Managed Extensibility Framework (MEF) 13 Distributed Caching with Velocity 13 ASP.NET MVC 16 A Tour of Visual Studio 2010 18 Windows Presentation Foundation 18 Historical Debugging 19 Improved JavaScript IntelliSense 21 jQuery Support 22 www.it-ebooks.info ■ CONTENTS vi Building a CMS 24 CMS Functional Requirements 24 Creating the Application Framework 25 Summary 28 ■Chapter 2: CMS Architecture and Development 29 Motivations for Building a CMS 29 Motivations for Using .NET 30 Application Architecture 30 The CMS Application Tiers 32 CommonLibrary: The Data Transfer Objects 33 GlobalModule: The HttpModule 35 Components of a CMS Page 37 Buckets 37 Embeddable Objects 39 Embeddable Permissions 41 Handling CMS Content 43 The Content Table 43 The ContentVersion Table 44 Assembling Content on Demand 44 How Embeddable Objects Handle Versions 46 Summary 46 ■Chapter 3: Parallelization 47 What Is Parallelization? 47 Good Parallelization Candidates 47 Differences from Multithreading 48 Parallel Pitfalls 48 Deadlocks 48 Race Conditions 51 Thread Starvation 54 www.it-ebooks.info ■ CONTENTS vii Amdahl’s Law 55 .NET 4 Parallelization Concepts 56 Task vs. Data Parallelism 56 Task Parallel Library 56 Task.Wait() 57 Parallel.For() and Parallel.ForEach() 59 Parallel LINQ (aka PLINQ) 59 .AsParallel() 60 CMS Parallelization Opportunities 61 Creating a Data Mining Embeddable 62 Expanding the Data Mining Tasks 66 Tagging 70 Tagging on the Client 73 Fleshing Out the Tagging Embeddable 75 What’s in a Name? 76 Handling Tag Input 79 Tag Processing in the Business Tier 82 POST Problems 87 Finalizing Tag Storage 89 Inserting Tags 92 Content Tags 96 Summary 102 ■Chapter 4: Managed Extensibility Framework and the Dynamic Language Runtime 103 Managed Extensibility Framework 103 The Manual Way 103 The MEF Way 105 Working from Usage to Implementation 106 Exposing Libraries via MEF 106 A Simple Plug-in Contract 107 www.it-ebooks.info ■ CONTENTS viii Implementing the Plug-In 107 Using the Plug-In 108 Catalogs and Containers 112 Supporting Multiple Parts 113 Dynamic Language Runtime 117 The dynamic Keyword 118 Benefits of the dynamic Keyword 119 CMS Plug-Ins 120 IEmbeddable 121 Server Controls as Embeddables 122 Displaying Embeddables 124 PageAssembler 125 Additional Methodology Benefits 128 Missing DLLs 128 Exceptions in Embeddables 129 A More Complex Emeddable 130 Breadcrumbs 130 Navigating the CMS Tree 131 Summary 133 ■Chapter 5: jQuery and Ajax in the Presentation Tier 135 An Introduction to jQuery 135 The $() Factory 136 Implicit Iteration 138 Ajax via jQuery 139 Caching and Ajax 140 Avoiding Caching on GET Requests 141 Lightweight Content Delivery with Ajax and HTTP Handlers 142 Handling Asynchronous Errors 147 Handling DOM Modifications 150 Improving the CMS Admin with jQuery 154 www.it-ebooks.info [...]... NET developers clean, standardized markup using traditional HTML elements as well as the complete elimination of ViewState The Model aspect refers to the data source of the application, which for our purposes will be a SQL database The Controller is the brain of the operation, fetching the appropriate information from the Model and feeding it to the View, which is our user interface MVC and WebForms... control over the markup on your applications You’re by no means limited to either MVC or the WebForms model; in fact, you’re quite free to mix and match within the same application The emphasis in NET moving forward is on options and choices, freeing developers from constraints and allowing them to make the choices that are most appropriate for the application at hand I Tip The technical name for the model... natural for you Further, although we will be focusing mainly on C#, there are situations where C# is not the best language in which to express a solution to a particular problem, and there are so many great choices available in NET 4 that it’s almost criminal to ignore them When a new language or tool is introduced, we’ll take some time to cover its syntax and capabilities before applying it to the CMS,... expert before tackling those sections I Caution I am using the Team System edition of Visual Studio 2010 for the writing of this book because there are components to the IDE that are made available only through that particular edition If you’re using Professional or Express versions of any of these tools, there will be certain components you won’t be able to use I will highlight these areas for you... some time learning about C# and ASP.NET and then returning to see some examples of new Microsoft technology that makes the experience more enjoyable What’s New in NET 4 Before we jump into Visual Studio, let’s take a look at the new features and tools that come with NET 4 For now we’ll take a quick look at each topic, effectively creating a preview of the contents of the rest of the book Each topic will... it to the design of the CMS (which you’ll learn about at the end of this chapter) Some of the tools and components I detail in this chapter are separate downloads from the core 4 framework; I have provided the current links and versions for your convenience 2 www.it-ebooks.info CHAPTER 1 I VISUAL STUDIO 2010 AND NET 4 I Note The Common Language Runtime (CLR) is Microsoft’s implementation of the Common... (DLR) The DLR has existed for some time but now comprises a core component of the NET Framework; the result is that IronPython and IronRuby now stand alongside C# and VB NET as full-fledged NET languages for developers to take advantage of Furthermore, if you have experience developing in Python or Ruby, the transition to NET will be smooth because the language is fundamentally the same, with the addition... later in the book, as well as ways to test the performance effects that parallelism has on our applications in different scenarios Task Parallel Library (TPL) Not content to only expose convenient parallelism to developers using LINQ, Microsoft has also created the Task Parallel Library (TPL) The TPL provides constructs familiar to developers, such as For and ForEach loops, but calls them via the parallel... http://www.microsoft.com/downloads/details.aspx?FamilyId=B24C3708-EEFF -40 55-A86719B5851E7CD2&displaylang=en ASP.NET MVC Microsoft, since the inception of ASP.NET, has essentially stuck to its WebForms model with a single form element on a page, ViewState fields, and so on The MVC framework, which stands for Model View Controller, is a pretty radical departure in the opposite direction and certainly one that developers have been requesting for quite some time To understand... version 4 of the NET Framework, Microsoft has radically improved the developer experience while maintaining the core framework that so many have become comfortable with As the framework has evolved over time, Microsoft has done an excellent job of preserving the functional core while adding impressive components on top, thereby reducing or eliminating breaking changes in most cases, which not only eases the . page count THE EXPERT’S VOICE ® IN .NET Pro ASP. NET 4 CMS Advanced Techniques for C# Developers Using the .NET 4 Framework Alan Harris Learn the latest. Alan Harris www.it-ebooks.info ii Pro ASP. NET 4 CMS: Advanced Techniques for C# Developers Using the .NET 4 Framework Copyright © 2010 by Alan Harris

Ngày đăng: 15/03/2014, 07:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan