Visual Studio 2010 and .NET 4 Six-in-One 0470499486, 9780470499481

Complete coverage of all key .NET 4 and Visual Studio 2010 languages and technologies .NET 4 is Microsoft's latest

597 65 37MB

English Pages 1274 Year 2010

Report DMCA / Copyright

DOWNLOAD FILE

Visual Studio 2010 and .NET 4 Six-in-One 
 0470499486, 9780470499481

Table of contents :
Visual Studio® 2010 and .NET 4: Six-in-One......Page 7
CONTENTS......Page 19
INTRODUCTION......Page 35
PART I: VISUAL STUDIO......Page 43
CHAPTER 1: HISTORY OF VISUAL STUDIO......Page 45
Other Languages and Tools......Page 46
Visual Studio. NET 2002 and 2003......Page 47
Visual Studio 2005......Page 49
Visual Studio 2008......Page 50
Changes in Editions......Page 52
Shift to WPF......Page 54
Summary......Page 55
Exploring the Start Page......Page 57
Understanding Window Management......Page 58
New Project Dialog Window......Page 59
Using the Add Reference Dialog Window......Page 61
Exploring the Code Editor Window......Page 62
Code Navigation......Page 64
Generate From Usage......Page 66
Exploring the Visual Designers......Page 67
WPF Designer......Page 68
New Tools for Architects......Page 69
Summary......Page 71
CHAPTER 3: VISUAL STUDIO CODE SNIPPETS......Page 73
Understanding Code Snippets......Page 74
Using Code Snippets......Page 76
HTML, SQL, and JScript Code Snippets......Page 79
Creating a Simple Code Snippet......Page 80
The Code Snippet File Structure......Page 83
Managing Code Snippets......Page 93
The Code Snippet Manager......Page 94
Code Snippet Storage......Page 95
Importing Snippets......Page 96
Multiple Snippets in a File......Page 98
Code Snippets in Other Languages......Page 100
Snippet Editors......Page 101
Export as Code Snippet Add- In......Page 102
Snippet Designer......Page 103
Snippet Editor......Page 104
Summary......Page 105
CHAPTER 4: VISUAL STUDIO TEMPLATES......Page 107
The Role of Templates......Page 108
Project Templates......Page 109
Item Templates......Page 111
Creating Templates......Page 112
Creating a Simple Project Template......Page 113
Creating a Simple Item Template......Page 118
Template Storage Structure......Page 123
Template Folders......Page 124
The Template Manifest File......Page 126
Template Parameters......Page 140
Custom Template Parameters......Page 141
Wizards......Page 143
Deploying Templates......Page 152
Exporting and Importing Templates......Page 153
Creating a Template Installation Kit......Page 156
Summary......Page 167
CHAPTER 5: GETTING THE MOST OUT OF THE IDE......Page 169
Visual Studio Window Architecture......Page 170
Tool Windows......Page 173
Document Windows......Page 174
Arranging Windows......Page 176
Customizing Menus and Toolbars......Page 180
The Customize Dialog......Page 181
Adding Menus and Commands......Page 182
Creating and Rearranging Toolbars......Page 186
The Options Dialog......Page 187
Changes in Option Pages......Page 189
Visual Studio Settings......Page 192
Command Routing and Command Contexts......Page 197
Working with Keyboard Shortcuts......Page 199
Working with Keyboard Mapping Schemes......Page 202
Custom Start Pages......Page 204
Creating Your First Custom Start Page......Page 205
Changing the StartPage.xaml File......Page 215
Accessing the Visual Studio Context......Page 218
Accessing the Visual Studio Object Model......Page 224
A Lap Around the Toolbox......Page 228
Customizing Toolbox Tabs......Page 231
Adding Items to the Toolbox......Page 232
Visual Studio Gallery......Page 235
Browsing the Visual Studio Gallery......Page 236
Downloading and Installing Components......Page 238
Adding Your Own Contributions to the Gallery......Page 239
Summary......Page 240
CHAPTER 6: VISUAL STUDIO EXTENSIBILITY......Page 243
The Visual Studio Shell and Packages......Page 244
Package Integration......Page 245
Extending Visual Studio by Customization......Page 246
Using Macros to Automate Common Tasks......Page 250
Visual Studio Add-Ins......Page 251
The Full Power of Extensibility......Page 252
Visual Studio Package Development......Page 253
Editor Extensibility......Page 254
Understanding the Structure of Macros......Page 255
Using the Macros IDE......Page 260
Recording and Developing Macros......Page 263
Macro Samples......Page 267
Add- In Architecture......Page 271
Creating a Simple Add-In......Page 272
Using the Automation Model......Page 281
Going on with Add-In Development......Page 283
Creating a Package with a Simple Menu Command......Page 284
Debugging the Package......Page 296
Extending the New Editor......Page 297
Extending the Editor with the Managed Extensibility Framework......Page 298
Editor Extensibility Points......Page 300
Creating a Simple Classifier......Page 302
Summary......Page 317
PART II: .NET 4......Page 319
Win/ Win32 Programming in C......Page 321
Programming in Visual Basic......Page 322
COM Programming......Page 323
The Origin and Goals of the .NET Framework......Page 324
Evolution of the .NET Framework......Page 325
.NET Framework 2.0......Page 328
.NET Framework 3.5......Page 329
.NET Framework 4.0......Page 330
.NET Framework Architecture......Page 331
Common Language Run-time (CLR)......Page 332
Base Class Library......Page 333
Services of the .NET Architecture......Page 334
Main Benefits of the .NET Framework......Page 335
Summary......Page 336
The Importance of User Experience......Page 339
Developers Are from Vulcan, Designers Are from Venus......Page 341
A New Generation of Presentation Frameworks......Page 343
The Ten Pillars of Silverlight......Page 345
XAML......Page 346
Tools for Working with Silverlight (and WPF)......Page 355
Layout......Page 357
Data Binding......Page 364
Styles......Page 372
Templates......Page 374
Animations......Page 383
Media......Page 387
Networking......Page 394
Other Features......Page 397
Windows Presentation Foundation......Page 401
WPF Features not Available in Silverlight......Page 403
Choosing Between WPF and Silverlight......Page 408
A Common Solution Format......Page 409
Blendability......Page 410
Design Time Sample Data in Blend......Page 411
SketchFlow......Page 412
Triggers, Actions, and Behaviors......Page 413
Model-View-ViewModel Pattern......Page 414
Summary......Page 415
WCF Versus ASMX Web Services......Page 417
A Quick Look at SOA......Page 418
Service Contract......Page 419
Building Blocks of the WCF Architecture......Page 420
Getting Started With WCF......Page 423
Creating the WCF Service......Page 424
Defining Data Contracts......Page 428
Specifying the Binding Information......Page 429
Hosting the WCF Service......Page 430
Creating the Service Proxy......Page 431
Creating the Service Client — The Service Consumer......Page 433
Working with an Ajax-Enabled WCF Service......Page 434
Implementing a WCF Service Declaratively......Page 436
Defining the Service Contract......Page 437
Implementing the Service Logic Declaratively......Page 438
Summary......Page 440
CHAPTER 10: ENHANCEMENTS TO THE .NET CORE FRAMEWORK......Page 441
In-Process Side-By-Side Execution......Page 442
DLR Integration......Page 444
Type Equivalence......Page 453
Parallel Computing......Page 457
The Challenge of Many-core Shift......Page 458
The Microsoft Approach......Page 460
Parallel LINQ......Page 463
Task Parallel Library......Page 470
Code Contracts......Page 497
The Challenge......Page 505
A Simple MEF Example......Page 507
Basic MEF Concepts......Page 513
Composition......Page 519
A Few More Points on MEF......Page 528
Summary......Page 529
CHAPTER 11: ENHANCEMENTS TO THE .NET WORKFLOW FRAMEWORK......Page 531
An Introduction to WF 4.0......Page 532
The Workflow Design Surface......Page 533
The Hello Workflow Application......Page 534
Creating Flowcharts and Coded Workflows......Page 541
Flowcharts in WF 4.0......Page 542
Code-Only Workflows......Page 547
Workflow Architecture......Page 551
WorkflowApplication and Hosts......Page 552
Activities......Page 553
Extensions......Page 554
Workflow Activity Model Changes......Page 555
Workflow Activity Library......Page 559
Flow Control Activities......Page 560
Workflow Run-Time Activities......Page 562
Flowchart-Specific Activities......Page 563
Error-Handling Activities......Page 564
Transaction-Handling Activities......Page 565
Collection-Handling Activities......Page 566
Messaging Activities......Page 567
The ConferenceWorkflow Example......Page 569
Implementing Cancellation, Confirmation, and Compensation......Page 570
Compensation......Page 572
Persistence and Human Interactions......Page 574
The DomainNameWorkflow Project......Page 575
Workflow Tracking......Page 586
Creating a Workflow Service......Page 593
Using WorkflowServiceHost......Page 595
Summary......Page 604
Language Integrated Query (LINQ)......Page 605
LINQ Operators......Page 606
LINQ Implementations......Page 608
Parallel LINQ (PLINQ)......Page 614
Entity Framework Architecture......Page 615
Summary......Page 621
Enhancements in WCF Framework 3.5......Page 623
Simplified Configuration......Page 625
Standard Endpoints......Page 627
Discovery......Page 628
REST Improvements......Page 630
Routing Service......Page 631
Summary......Page 634
CHAPTER 14: .NET CHARTING COMPONENTS......Page 635
Creating a Simple Chart......Page 636
Adding Data to the Chart Programmatically......Page 640
Adding Charts to WPF Applications......Page 645
Using Chart Controls......Page 647
Elements of a Chart......Page 648
The Chart Class......Page 649
Chart Types......Page 651
Chart Coordinate System......Page 659
Three-Dimensional Charts......Page 661
Appearance of Chart Elements......Page 663
Axes and Related Chart Elements......Page 665
Data Points......Page 672
Annotations......Page 675
Binding Data to Series......Page 680
The DataManipulator class......Page 683
More Chart Manipulations......Page 690
Summary......Page 691
PART III: ASP.NET 4.0......Page 693
Development of the Web and Web Development......Page 695
Enter ASP......Page 696
Enter ASP.NET......Page 697
ASP.NET Version History......Page 699
ASP.NET 2.0......Page 701
ASP.NET 3.0......Page 706
ASP.NET 3.5......Page 707
ASP.NET 4.0......Page 709
Summary......Page 710
CHAPTER 16: ASP.NET CHARTING CONTROLS......Page 711
Adding a Chart Control to a Page......Page 712
Setting up Charts in an Event Handler Method......Page 716
Binding Data to the Chart......Page 718
Rendering ASP.NET Charts......Page 721
Image URL Rendering......Page 722
Using Charts with Legacy Web Sites......Page 725
Binary Stream Rendering......Page 726
Saving Chart State......Page 730
Advanced Chart State Management......Page 732
Using Tooltips......Page 736
Handling Clicks on Data Points......Page 738
Interactivity With Ajax......Page 739
Summary......Page 751
Working Against a Data Model......Page 753
Displaying Data from Existing Tables......Page 758
Creating Simple CRUD Applications......Page 760
Creating a Dynamic Data Application for Master-Detail Relationships......Page 767
Understanding Dynamic Data's Structure......Page 772
Customizing the Look and Feel......Page 774
Working with Page Templates......Page 777
Working with Field Templates......Page 780
Working with Entity Templates......Page 783
Working with Filter Templates......Page 786
Creating Custom Pages......Page 788
Customizing Validations......Page 789
Summary......Page 792
CHAPTER 18: ASP.NET MODEL VIEW CONTROLLER (MVC)......Page 793
Introduction to MVC......Page 794
Microsoft and the Web Platform......Page 795
What Is Microsoft ASP.NET MVC 2?......Page 796
Extensibility in MVC......Page 802
Creating an MVC 2 Application......Page 803
The Project Structure......Page 805
How Does it Work?......Page 806
Create a Database......Page 813
Create a Model......Page 814
Listing Books......Page 815
Adding Book Actions......Page 821
Model Binding......Page 832
Validation......Page 837
UI Customization......Page 846
Controller Factory......Page 858
Influencing the Execution Flow......Page 859
Authorization......Page 861
Action and Result Filtering......Page 863
ActionResult......Page 864
Refactoring AcmeLibrary......Page 866
Creating and Running Unit Tests......Page 873
Value Providers......Page 876
Summary......Page 877
CHAPTER 19: ASP.NET AJAX IMPROVEMENTS......Page 879
Understanding Ajax......Page 880
The XMLHttpRequest Object......Page 881
ASP.NET and Ajax......Page 882
Using the ASP.NET Ajax Server Controls......Page 883
Refactoring the Framework Libraries......Page 886
Using the Microsoft CDN......Page 888
Using the Microsoft Ajax Library......Page 890
Working with DOM Elements......Page 894
The Script Loader......Page 897
Client-Side Data Binding with Templates......Page 901
Advanced Data-Binding Scenarios......Page 914
Working with Server-Side Data......Page 920
Summary......Page 934
CHAPTER 20: ASP.NET AJAX CONTROL TOOLKIT AND JQUERY......Page 935
Installing the Ajax Control Toolkit......Page 936
Creating a Simple Web Application with the Toolkit......Page 938
Using the Controls of the Toolkit......Page 950
New Server Controls......Page 957
Control Extenders......Page 980
Animations......Page 999
The jQuery Library......Page 1004
"Hello, World" with jQuery......Page 1005
Selectors and Filters......Page 1007
Chaining and Utility Functions......Page 1012
Eventing Model and Event Handlers......Page 1013
Visual Effects and Animations......Page 1017
JQuery Ajax Features......Page 1018
Summary......Page 1019
PART IV: VB.NET......Page 1021
CHAPTER 21: HISTORY OF VISUAL BASIC......Page 1023
Structured and Unstructured BASIC......Page 1024
Moving to "Visual"......Page 1026
Visual Basic in the 1990s......Page 1027
Design Goals and Debates......Page 1028
Visual Basic .NET (7.0) and .NET 2003 (7.1)......Page 1029
Visual Basic 2005 (8.0)......Page 1031
Visual Basic 2008 (9.0)......Page 1039
Summary......Page 1047
CHAPTER 22: VISUAL BASIC 10.0 LANGUAGE IMPROVEMENTS......Page 1049
Implicit Line Continuation......Page 1050
Auto-Implemented Properties......Page 1052
Collection Initializers......Page 1054
Multiline Lambda Expressions......Page 1060
Working with Dynamic Objects......Page 1062
Late Binding in Visual Basic 2010......Page 1063
Accessing an IronPython Library......Page 1065
Type Substitution......Page 1068
Variance in Visual Basic 2010......Page 1071
A Few More Points on Variance......Page 1075
Summary......Page 1080
PART V C#......Page 1081
The Evolution of C#......Page 1083
Short History......Page 1084
Implementations......Page 1085
Type System......Page 1086
Memory Management......Page 1087
Syntactic Sugar......Page 1088
C# 2.0......Page 1089
Generic Types......Page 1090
Partial Types......Page 1092
Static Classes......Page 1093
Anonymous Methods......Page 1094
Delegate Covariance and Contravariance......Page 1095
Nullable Types......Page 1096
Property Accessors......Page 1097
C# 3.0......Page 1098
Extension Methods......Page 1099
Anonymous Types......Page 1100
Lambda Expressions......Page 1101
Query Expressions......Page 1102
Expression Trees......Page 1103
Object Initializers......Page 1104
Partial Methods......Page 1105
Summary......Page 1106
CHAPTER 24: C# 4.0 LANGUAGE IMPROVEMENTS......Page 1107
Creating the PainWithOffice Application......Page 1108
Frustrating Issues......Page 1111
Remove the Pain......Page 1112
Dynamic Binding......Page 1114
The dynamic Type......Page 1115
Dynamic Operations......Page 1116
The Dynamic Language Run-time......Page 1119
Named and Optional Parameters......Page 1120
Using Optional Parameters......Page 1121
Using Named Parameters......Page 1123
Overload Resolution......Page 1124
Omitting ref from Parameters......Page 1126
Indexed Properties......Page 1127
Compiling Without PIAs......Page 1128
Type Substitution......Page 1129
Bird's-Eye View of Variance......Page 1131
Variance in C# 4.0......Page 1132
A Few More Points on Variance......Page 1136
Summary......Page 1141
PART VI F#......Page 1143
CHAPTER 25: VISUAL F# AND THE OTHER .NET LANGUAGES......Page 1145
A Brief History of F#......Page 1146
F# at First Glance......Page 1147
Trying Things Out with F#......Page 1148
Understanding Syntax......Page 1149
Your First F# Project......Page 1154
Namespaces and Modules......Page 1155
Literals and Bindings......Page 1157
Expressions......Page 1162
Values and F# Types......Page 1166
Type Augmentations......Page 1179
Computation Expressions......Page 1180
Sequences......Page 1183
Sequence Expressions......Page 1185
Asynchronous Workflows......Page 1186
Pattern Matching......Page 1188
Active Patterns......Page 1191
Exceptions......Page 1196
Units of Measure......Page 1199
Lazy Computations......Page 1201
Quotations......Page 1202
Working with Database Queries......Page 1203
A Larger Application in F#......Page 1205
The Language Module......Page 1206
The Evaluator Module......Page 1208
The FunctionPlotter Module......Page 1209
IronPython......Page 1212
Summary......Page 1213
INDEX......Page 1215

Polecaj historie