Contents

PM Milestone Project Management Templates

PM Milestone 7000 Project Management Templates

Get Instant Access

INTRODUCTION xxxv

CHAPTER 1: VISUAL STUDIO 2010 3

Visual studio 2010: Express through Ultimate 4

Visual Basic Keywords and syntax 7

Console Applications 10

Creating a Project from a Project Template 11

The Solution Explorer 14

Project Properties 15

Assembly Information Screen 16

Compiler Settings 17

Debug Properties 21

References 22

Resources 24

Settings 25

Other Project Property Tabs 28

Project ProVB_Vs2010 28

Form Properties Set in Code 31

Additional Components for Visual Studio 39

enhancing a sample Application 40

Customizing the Code 41

Building Applications 45

Reusing Your First Windows Form 52

Useful Features of Visual studio 2010 54

Build Configurations 54

The Task List 56

The Command Window 57

Server Explorer 57

Recording and Using Macros in Visual Studio 2010 58

Class Diagrams 60

Application Lifecycle Management 61

Performance Tools 64

summary 66

cHAPTER 2: objects AND VisuAL BAsic 67

Object-Oriented Terminology 68

Objects, Classes, and Instances 68

Composition of an Object 69

System.Object 72

Working With Visual Basic Types 72

Value and Reference Types 73

Primitive Types 75

Commands: Conditional 76

If Then 77

Comparison Operators 77

Select Case 79

Value Types (Structures) 79

Boolean 80

Integer Types 81

Unsigned Types 82

Decimal Types 82

Char and Byte 85

DateTime 85

Reference Types (Classes) 86

The Object Class 86

The String Class 87

XML Literals 91

The DBNull Class and IsDBNull Function 92

Parameter Passing 93

ParamArray 94

Variable Scope 94

Working with Objects 95

Objects Declaration and Instantiation 95

Object References 96

Dereferencing Objects 97

Early Binding versus Late Binding 97

Data Type Conversions 98

Performing Explicit Conversions 99

Creating Classes 103

Basic Classes 103

Handling Events 113

Handling Multiple Events 113

The WithEvents Keyword 114

Raising Events 114

Declaring and Raising Custom Events 115

Receiving Events with WithEvents 116

Receiving Events with AddHandler 117

Constructor Methods 119

Termination and Cleanup 119

Advanced Concepts 120

Overloading Methods 121

Overloading Constructor Methods 123

Shared Methods, Variables, and Events 124

Operator Overloading 128

Delegates 130

Classes versus Components 134

Lambdas 135

Summary 136

CHAPTER 3: CUSTOM OBJECTS 137

Inheritance 138

Implementing Inheritance 139

Interacting with the Base Class, Your Class, and Your Object 159

Simple Constructors 164

Creating an Abstract Base Class 175

Multiple Interfaces 177

Object Interfaces 177

Secondary Interfaces 178

Abstraction 184

Encapsulation 187

Polymorphism 189

Method Signatures 189

Inheritance 198

When to Use Inheritance 198

How Deep to Go? 205

Summary 208

CHAPTER 4: THE COMMON LANGUAGE RUNTIME 211

Elements of a .NET Application 212

Modules 212

Assemblies 213

Types 214

Versioning and Deployment 214

Better Support for Versioning 214

Major. Minor. Build. Revision 215

Better Deployment 215

Cross-Language Integration 216

The Common Type System 216

Metadata 217

Better Support for Metadata 218

Attributes 218

The Reflection API 220

IL Disassembler 221

Memory Management 221

Traditional Garbage Collection 222

Faster Memory Allocation for Objects 228

Garbage Collector Optimizations 229

Namespaces 231

What Is a Namespace? 231

Namespaces and References 234

Common Namespaces 236

Importing and Aliasing Namespaces 238

Aliasing Namespaces 239

Referencing Namespaces in ASPNET 240

Creating Your Own Namespaces 240

The My Keyword 242

My.Application 243

My Computer 246

My. Forms Namespace 249

My. Resources 249

My. User 250

Extending the My Namespace 250

Summary 252

CHAPTER 5: DECLARATIVE PROGRAMMING

WITH VISUAL BASIC 253

Declarative Programming and Visual Basic 254

Using XAML to Create a Window 255

XAML Syntax 258

XAML Language Basics 259

XAML Directives 261

Using XAML to Declare a Workflow 262

Summary 264

CHAPTER 6: EXCEPTION HANDLING AND DEBUGGiNG 267

New in Visual Studio 2010 Team System: Historical Debugging 267

Notes on Compatibility with VB6 268

Exceptions in .NET 268

Important Properties and Methods of an Exception 268

Structured Exception-Handling Keywords 269

The Try, Catch, and Finally Keywords 270

The Throw Keyword 271

Throwing a New Exception 272

The Exit Try Statement 273

Nested Try Structures 274

Using Exception Properties 275

The Message Property 276

The InnerException and TargetSite Properties 276

Interoperability with VB6-Style Error Handling 279

Error Logging 280

The Event Log 280

Events, Methods, and Properties 281

Writing to Trace Files 283

Summary 284

CHAPTER 7: TEST-DRIVEN DEVELOPMENT 287

When and How to Test 288

Using Assertions 288

TDD Tools in Visual Studio 290

UnitTesting Walk-Through 291

Creating a Test 291

Running a Test 293

Testing Data Access Code 295

Using the Generate from Usage Feature 302

Other Visual Studio Editions 305

Third Party Testing Frameworks 306

Summary 307

CHAPTER 8: ARRAYS, COLLECTIONS, AND GENERICS 311

Arrays 312

Multidimensional Arrays 313

The UBound Function 314

The ReDim Statement 314

The Preserve Keyword 315

Collections 315

Generics 320

Using Generics 321

Nullable Types 322

Generic Types 322

Generic Methods 326

Creating Generics 327

Generic Types 327

Generic Methods 333

Constraints 334

Generics and Late Binding 337

Covariance and Contravariance 337

summary 339

CHAPTER 9: USING XML WITH VISUAL BASIC 341

An Introduction to XML 342

XML serialization 343

Source Code Style Attributes 347

system.Xml Document support 348

XML stream-style Parsers 348

Writing an XML Stream 349

Reading an XML Stream 351

Document Object Model (DOM) 359

XsL Transformations 363

XSLT Transforming between XML Standards 366

Other Classes and Interfaces in System. Xml. Xsl 368

XML in AsP.NET 369

The XmlDataSource Server Control 369

The XmlDataSource Control's Namespace Problem 373

The Xml Server Control 373

LINQ to XML 375

LINQ Helper XML objects 375

XDocument 375

XElement 375

XNamespace 376

XAttribute 378

Visual Basic and XML Literals 379

Using LINQ to Query XML Documents 380

Querying Static XML Documents 380

Querying Dynamic XML Documents 381

Working with the XML Document 382

Reading from an XML Document 382

Writing to an XML Document 384

lambda Expressions in Visual Basic 385

summary 387

CHAPTER 10: ADO.NET AND LINQ 389

ADo.NET Architecture 390

Basic ADo.NET Features 391

Common ADO.NET Tasks 391

Basic ADO .NET Namespaces and Classes 395

ADO. NET Components 396

.NET Data Providers 398

Connection Object 398

Command Object 399

Using Stored Procedures with Command Objects 399

DataReader Object 402

Executing Commands Asynchronously 404

DataAdapter Objects 406

SQL Server . NET Data Provider 409

OLE DB .NET Data Provider 409

The Dataset Component 410

DataTableCollection 410

DataRelationCollection 410

ExtendedProperties 411

Creating and Using DataSet Objects 411

ADO.NET DataTable Objects 413

Advanced ADO .NET Features of the DataSet and DataTable Objects 414

Working with the Common Provider Model 416

Connection Pooling in ADo.NET 418

Transactions and system.Transactions 418

Creating Transactions 419

Creating Resource Managers 421

LINQ to sQL 421

LINQ to sQL and Visual Basic 422 Retrieving Data Using LINQ to SQL: Creating the Console Application 422

Introducing the O/R Designer 423

Creating the Product Object 424

How Objects Map to LINQ Objects 425

The DataContext Object 426

The Table(TEntity) Object 428

Querying the Database 428

Using Query Expressions 429

Query Expressions in Detail 429

Filtering Using Expressions 429

Performing Joins 430

Grouping Items 431

Stored Procedures 432

Updating the Database 433

Summary 435

CHAPTER 11: DATA ACCESS WITH THE ENTITY FRAMEWORK 437

Object-Relational Mapping 438

Entity Framework Architecture 438

Conceptual Model 439

Storage Model 442

Mapping Model 443

LINQ to Entities 443

The ObjectContext 445

Mapping Objects to Entities 446

Simple Mapping 446

Using a Single Table for Multiple Objects 448

Using Multiple Tables for an Object 450

Generating the Database from a Model 452

Updating the Model 454

Summary 456

CHAPTER 12: WORKING WITH SQL SERVER 457

SQL Server Compact 458

Connecting to a SQL Server Compact Database 459

Synchronizing Data 462

SQL Server's Built-in XML Features 468

CLR Integration In SQL Server 470

Deciding between T-SQL and Visual Basic 470

Creating User-Defined Types 471

Creating Stored Procedures 483

Exposing Web Services from SQL Server 489

SQL Server 2008 Features 494

WCF Data Services 495

REST 495

Atom and JSON 495

Exposing Data Using WCF Data Services 497

WCF Data Services Client Library 501

Summary 505

cHAPTER 13: sERVicEs (xML/WcF) 507

Introduction to Services 508

The Network Angle 508

Application Development 508

Merging the Network and Application Development 508

The Foundations of Web Services 509

The Problems 510

Some Other Players 511

Web Services 511

What Makes a WCF Service 512

The Larger Move to SOA 513

Capabilities of WCF 514

Contracts and Metadata 514

Working with the WS-* Protocols 515

Building a WCF Service 516

Building a WCF Consumer 523

Adding a Service Reference 523

Reviewing the Reference 525

Configuration File Changes 528

Writing the Consumption Code 529

Working with Data Contracts 531

Building a Service with a Data Contract 532

Namespaces 533

Building the Host 533

Building the Consumer 534

Looking at WSDL and the Schema for HelloCustomerService 536

Summary 538

cHAPTER 14: WINDoWS FoRMS 541

The System.Windows.Forms Namespace 541

Using Forms 542

Setting a Startup Form 542

Showing Forms via Sub Main 543

More about the Application Class 543

Startup Location for a Form 543

Form Borders 544

Always on Top — the TopMost Property 544

Owned Forms 544

Making Forms Transparent and Translucent 545

Visual Inheritance 547

Scrollable Forms 547

MDI Forms 547

An MDI Example in VB 2010 548

Dialog Forms 549

Forms at Runtime 550

Default Instances of Forms 551

Controls 552

Control Tab Order 552

Properties for All Controls 552

Dynamic Sizing and Positioning of Controls 553

FlowLayoutPanel Control 555

TableLayoutPanel Control 556

Panel and GroupBox Container Controls 556

Extender Providers 557

Advanced Capabilities for Data Entry 559

Validating Data Entry 561

Toolbars and the ToolStrip Control 562

Menus 564

Common Dialogs 566

Drag and Drop 568

Summary of Standard Windows .Forms Controls 569

Handling Groups of Related Controls 571

Adding Controls at Runtime 572

Other Handy Programming Tips 573

Summary 573

CHAPTER 15: ADVANCED WINDOWS FORMS 575

Packaging Logic in Visual Controls 575

Custom Controls in Windows Forms 576

Inheriting from an Existing Control 576

Building a Composite Control 576

Writing a Control from Scratch 577

Inheriting from an Existing Control 577

Process Overview 577

Writing Code for an Inherited Control 578

Other Useful Attributes 581

Defining a Custom Event for the Inherited Control 581

A CheckedListBox Limiting Selected Items 582

The Control and UserControl Base Classes 584

The Control Class 585

The UserControl Class 585

A Composite UserControl 586

Creating a Composite UserControl 586

Resizing the Control 587

Exposing Properties of Contained Controls 587

Stepping through the Example 588

Building a Control from Scratch 591

Painting a Custom Control with GDI+ 591

Attaching an Icon for the Toolbox 595

Embedding Controls in Other Controls 595

Summary 597

CHAPTER 16: USER CONTROLS COMBINING WPF

AND WINDOWS FORMS 599

The Integration Library 600

Hosting WPF Controls in Windows Forms 601

Creating a WPF Control Library 602

The Windows Forms Application 604

Hosting Windows Forms Controls in WPF 610

Integration Limitations 614

Summary 615

CHAPTER 17: WPF DESKTOP APPLICATIONS 617

What, Where, Why, How - WPF Strategy 618

Raster Graphics and Vector Graphics 619

Should Your Next Windows Project Use WPF? 619

Creating a WPF Application 620

Implementing a Custom WPF Application 621

Customizing the User Interface 633

Customizing the Buttons 641

Summary 666

CHAPTER 18: EXPRESSION BLEND 3 667

Getting to Know Blend 668

Creating a New Project 668

SketchFlow 674

Your First SketchFlow 674

SketchFlow Player 676

Documenting Your SketchFlow 678

Summary 678

CHAPTER 19: SILVERLIGHT 679

What Is Silverlight? 679

Smooth Streaming 680

Industry Standard Video 680

Digital Rights Management 680

Starting a Silverlight Project 680

Silverlight Application 681

Silverlight Navigation Application 681

Silverlight Class Library 682

Silverlight Solution 682

Web Application 682

Application Library Caching 682

Silverlight Application 683

Controls 685

Layout Management 686

Adding Items to the Silverlight Project 692

Silverlight User Control 693

Silverlight Application Class 693

Silverlight Page 693

Silverlight Child Window 694

Silverlight Template Control 694

Silverlight Resource Dictionary 694

Silverlight Out of the Browser 694

Summary 695

CHAPTER 20: SILVERLIGHT AND SERVICES 699

Services and Silverlight 699

ASMX Web Service 700

WCF Service 702

ADO.NET Data Service 705

Model-View-ViewModel 714

Separation of Concerns 714

The Model 714

The View 717

The ViewModel 717

Summary 718

CHAPTER 21: WORKING WITH ASP.NET 719

The History of ASP.NET 719

Key Features of ASP.NET 720

Developer Productivity 720

Performance and Scalability 720

Localization 721

Health Monitoring 721

Easy Access to Data 721

Administration and Management 721

Visual Studio Support for ASP.NET 721

Web Site and Web Application Projects 722

ASP NET Application Folders 722

Web Server Options 723

Building ASP.NET Applications Using Web Forms 723

Pages, Forms, Controls, and Events 724

Data-Driven Applications 735

Data Binding with the SqlDataSource Control 735

Data Binding with the LinqDataSource Control 743

Data Binding with the ObjectDataSource Control 746

Summary 749

CHAPTER 22: ASP.NET ADVANCED FEATURES 751

Master Pages 751

Creating a Master Page 752

Creating the Content Page 755

Providing Default Content in Your Master Page 758

Navigation 758

Using the SiteMapPath Server Control 759

Menu Server Control 760

Working with the ASP.NET Provider Model 761

Creating an Application Services Database 762

Membership and Role Management 766

Profile Properties 771

Microsoft Ajax (AsP.NET AJAX) 772

Understanding the Need for Ajax 773

Microsoft Ajax Implementation 773

UpdatePanel Control vs. Client-Side Service Calls 775

Introducing the Sample Project 775

Adding the UpdatePanel Control 778

Using Client-Side Service Calls and Client Templates 780

summary 785

CHAPTER 23: ASP.NET MVC 787

Model-View-Controller and AsP.NET 788

Building an AsP.NET MVC Application 788

Creating the Project 788

Controllers and Actions 789

Adding the Model 792

Views 793

Routing 796

Scaffolding and CRUD Operations 797

Validation 804

summary 806

CHAPTER 24: SHAREPOINT 2010 DEVELOPMENT 807

Introduction 807

SharePoint Foundation 2010 808

SharePoint Server 2010 808

SharePoint Terminology 808

The SharePoint Development Environment 809

Features and the solutions Framework 809

Features 809

Solution Framework 817

Visual studio Tools for sharePoint Development 821

The sharePoint 2010 object Models 827

Server Object Model 828

Client Object Models 831

Building Web Parts 833

summary 839

PART V: LIBRARIES AND SPEOiALiZED TOPiCS

CHAPTER 25: VISUAL STUDIO TOOLS FOR OFFICE 843

Examining the Vsto Releases 844

Office Automation versus VSTO 844

PIA-Free Deployment 844

VSTO Project Types 845

office Business Application Architecture 846

Working with Both VBA and VSTo 847

Creating a Document Template (Word) 852

Adding Content to the Document 854

Adding a Ribbon and an Actions Pane 856

Activating the Actions Pane 859

Updating a Content Control 862

Creating an office add-In (Excel) 864

outlook Form regions 871

Summary 880

CHAPTER 26: WINDOWS WORKFLOW FOUNDATION 881

Workflow in Applications 881

Building Workflows 882

Adding Workflow with Windows Workflow Foundation 882

A Simple Workflow 884

Standard Activities 887

A Less Simple Workflow 889

Building Custom Activities 896

Dynamically Loading Workflows 899

Rehosting the Workflow Designer 900

summary 903

CHAPTER 27: LOCALIZATION 905

Cultures and Regions 905

Understanding Culture Types 906

Looking at Your Thread 907

Declaring Culture Globally in ASP. NET 908

Adopting Culture Settings in ASP.NET 909

Translating Values and Behaviors 910

Understanding Differences in Dates 910

Differences in Numbers and Currencies 913

Understanding Differences in Sorting 915

ASP.NET Resource Files 916

Making Use of Local Resources 916

Global Resources 921

Resource Files in Windows Forms 923

Summary 927

cHAPTER 28: coM-INTERoP 929

Understanding COM 930

COM and .NET in Practice 931

A Legacy Component 931

The . NET Application 932

Trying It All Out 935

Using TlbImp Directly 935

Late Binding 936

ActiveX Controls 940

The Legacy ActiveX Control 940

A .NET Application, Again 941

Trying It All Out, Again 944

Using .NET Components in the COM World 944

A .NET Component 944

RegAsm 946

TlbExp 947

P/lnvoke 947

Windows API Code Pack 948

Summary 948

chapter 29: network programming 949

Protocols, Addresses, and Ports 949

Addresses and Names 951

Ports: They're Not Just for Ships 952

Firewalls: Can't Live with Them, Can't Live without Them 952

The System.Net Namespace 953

Web Requests (and Responses) 953

Simplifying Common Web Requests with WebClient 958

Sockets 960

Building the Application 960

Creating Conversation Windows 962

Sending Messages 969

Shutting Down the Application 973

Using Internet Explorer in Your Applications 976

Windows Forms and HTML — No Problem! 976

Summary 979

CHAPTER 30: APPLICATION SERVICES 981

Using IIS for Application Services 981

Windows Services 982

Characteristics of a Windows Service 982

Interacting with Windows Services 983

Creating a Windows Service 984

The .NET Framework Classes for Windows Services 984

Other Types of Windows Services 987

Creating a Windows Service in Visual Basic 987

Creating a File Watcher Service 988

Creating a Solution for the Windows Service 988

Adding .NET Components to the Service 989

Installing the Service 992

Starting the Service 992

Uninstalling the Service 993

Communicating with the Service 994

The ServiceController Class 994

Integrating a ServiceController into the Example 995

More about ServiceController 996

Custom Commands 997

Passing Strings to a Service 998

Debugging the Service 998

Summary 1000

CHAPTER 31: ASSEMBLIES AND REFLECTION 1001

Assemblies 1002

The Manifest 1002

Assembly Identity 1004

Referenced Assemblies 1006

Assemblies and Deployment 1006

Application-Private Assemblies 1006

Shared Assemblies 1007

Versioning Issues 1008

Application Isolation 1008

Side-By-Side Execution 1009

Self-Describing Components 1009

Version Policies 1009

Configuration Files 1010

Basics of Reflection 1013

The Assembly Class 1014

Getting Currently Loaded Assemblies 1014

The Type Class 1015

Dynamic Loading of Assemblies 1016

The LoadFrom Method of the Assembly Class 1016

Dynamic Loading Example 1017

Putting Assemblies to Work 1018

Summary 1019

CHAPTER 32: SECURITY IN THE .NET FRAMEWORK 1021

Security Concepts and Definitions 1022

Permissions in the System.Security.Permissions Namespace 1023

Code Access Permissions 1026

Identity Permissions 1026

Role-Based Permissions 1027

Managing Code Access Permission Sets 1029

User Access Control 1032

Defining Your Application UAC Settings 1033

Security Tools 1034

Exceptions Using the SecurityException Class 1035

Encryption Basics 1036

Hash Algorithms 1037

Summary 1049

CHAPTER 33: PARALLEL PROGRAMMING USING TASKS

AND THREADS 1051

Launching Parallel Tasks 1051

System.Threading.Tasks .Parallel Class 1052

Parallel. Invoke 1052

Transforming Sequential Code to Parallel Code 1057

Detecting Hotspots 1057

Measuring Speedups Achieved by Parallel Execution 1060

Understanding Parallel and Concurrent Execution 1061

Parallelizing Loops 1062

Parallel.For 1062

Parallel.ForEach 1067

Exiting from Parallel Loops 1072

specifying the Desired Degree of Parallelism 1076

ParallelOptions 1077

Understanding Hardware Threads and Logical Cores 1078

Creating and Managing Tasks 1079

System.Threading.Tasks.Task 1080

Understanding a Task's Life Cycle 1081

Using Tasks to Parallelize Code 1082

Returning Values from Tasks 1090

Preparing the Code for Concurrency and Parallelism 1093

Understanding Concurrent Collection Features 1094

Transforming LINQ into PLINQ 1097

summary 1099

CHAPTER 34: DEPLOYMENT 1101

Application Deployment 1102

Why Deployment Is Straightforward in .NET 1102

XCOPY Deployment 1102

Using the Windows Installer 1102

ClickOnce Deployment 1103

Choosing a Framework Version 1103

Visual studio Deployment Projects 1103

Project Templates 1104

Creating a Deployment Project 1105

Modifying the Deployment Project 1109

Project Properties 1109

The File System Editor 1111

The Registry Editor 1115

The File Types Editor 1117

The User Interface Editor 1118

The Custom Actions Editor 1120

The Launch Conditions Editor 1122

Building 1124

Internet Deployment of Windows applications 1124

No-Touch Deployment 1125

ClickOnce Deployment 1126

iis Web Deployment Tool 1133

summary 1135

APPENDIX A: THE VISUAL BASIC COMPILER 1137

APPENDIX B: VISUAL BASIC POWER PACKS TOOLS

1151

APPENDIX C: WORKFLOW 2008 SPECIFICS

1165

APPENDIX D: ENTERPRISE SERVICES

1185

APPENDIX E: PROGRAMMING FOR THE CLOUD

1205

INDEX

1233

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment