Professional Documents
Culture Documents
38
Presented by
Coming...
March 13, 2006
New York City
GE 25
www.ajaxseminar.com
SEE PA
ETAILS
Building a custom server control FOR D
Marriott Marquis
Times Square, NYC
Create XML Easily with FOR XML PATH The OO Database Advantage
New FOR XML features simplify XML creation Painless object-oriented databases
Presorted
Standard
US Postage
PAID
St. Croix Press
Creating Composite Server
Controls in ASP.NET 2.0
Make new components from old
W W W . D O T N E T D E V E L O P E R S J O U R N A L . C O M
SUPERCHARGE
YOUR APPS WITH
THE POWER OF
LOCATION
INTELLIGENCE Enable Location Intelligent web services
110
Contact us at sales@mapinfo.com
DBA: “I suspect it’s your application server
code that’s causing the problem.”
App Dev: “It must be a database problem.”
Get a FREE “No more finger pointing” T-shirt. >> > > Learn more at www.radview.com/analyze
110100010110100010110100101010101000101101
00101010110100010110100011101001010101011
© RadView Software, Limited.All rights reserved. The Smart Choice in Web Application Testing
J a n u a r y 2 0 0 6 Volume 4 Issue 1
Inside DNDJ 10
EDITORIAL
30
PERFORMANCE
������������������������������������
�������������������������������������
�������������������������������������������
������������������������������������������������������������������
��������������������������������������������
������������������������������������������������������������������
�
���������������������������������� ������������������������������
����������������������������������������������������������������������
������������������������������������������������������������������������
�������������������������������������������
��������������������������������������
4 ��������������������������������������������������������
����������������������������������������
4 ����������������������������������������������������������������
�����������������������������������������������������
���������������������������
4 ����������������������������������������������������������
�������������������������������������������������������� ��������������������������������������������
���������������������
4 ������������������������������������������������
����������������������������������������������������������������
������������������������������������ ��������������
���������������������
�������������
�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
Editorial
EDITORIAL BOARD
Five Development Tools
I Wish I Had
dotnetboard@sys-con.com
Editor-in-Chief
Derek Ferguson derekf@speakeasy.net
Executive Editor
Seta Papazian seta@sys-con.com
Group Publisher
Jeremy Geelan jeremy@sys-con.com BY DEREK FERGUSON
Mobility Editor EDITOR-IN-CHIEF
Jon Box jbox@psgi.net
Security Editor
i
Patrick Hynds phynds@criticalsites.com ’ve been doing a lot of cod- to be able to tell instantly by looking
Open Source Editor ing lately. This has been a at a piece of code who added a certain AUTHOR BIO:
Dennis Hayes dennisdotnet@yahoo.com
Product Reviews Editor bit of a departure from my line of it, and when? It would make it Derek Ferguson is an
Doug Holland doug.holland@precisionobjects.com
VB Editor usual work as a technology so much easier to figure out whose associate director in the
Keith Franklin keithf@magenic.com evangelist or a development manager, butt needed kicking when you see rank Information Technology Group
Smart Client Editor
Tim Huckaby timh@interknowlogy.com but – as you might imagine – it has stupidity. at Bear Stearns, a leading global
BizTalk Editor
Brian Loesgen brian.loesgen@neudesic.com been quite a lot of fun! Having said this, investment banking, securities,
ADVISORY BOARD
the process of actually sitting down Automated File Use Request trading, and brokerage firm.
dotnetadvisors@sys-con.com and coding for 12 hours a day over the In keeping with the topic of source
Derek Ferguson derekf@magenic.com past few months has left me wishing control for a moment… we have been 4derek@sys-con.com
Seta Papazian seta@sys-con.com
Jeremy Geelan jeremy@sys-con.com that Visual Studio .NET shipped with using Source Safe. There are quite a
Thom Robbins trobbins@microsoft.com
John Gomez John.Gomez@eclipsys.com a handful of additional capabilities in few of us on the team and we have not
Scott Hanselman scott@hanselman.com
Dean Guida deang@infragistics.com the box. (because it never works out right) turned
John Sharp johns@contentmaster.com on multiple check-outs. This means
Jacob Cynamon jacobcy@microsoft.com
Chris Mayo cmayo@microsoft.com Track Changes that I have to e-mail people two or three
Gary Cornell gary@thecornells.com
Joe Stagner joestag@microsoft.com If you’ve ever written a book – or times a day – every day – to ask them if I
Peter DeBetta peter@debetta.com even an article – you have probably could please use their files. I’d like to be
Editor
Nancy Valentine nancy@sys-con.com encountered the “track changes” fea- able to ask Visual Studio to do this for
Online Editor ture of Microsoft Word. By turning on me, right off the dialog where it tells me
Roger Strukhoff roger@sys-con.com
change tracking, every modification that a given file is currently in use.
WRITERS IN THIS ISSUE
Bruce Armstrong, Jerry Dixon, Eric Falsken, Derek Ferguson,
SUBSCRIPTIONS
For subscriptions and requests for bulk orders,
please send your letters to Subscription Department
Subscription Hotline: subscribe@sys-con.com
out whose butt needed kicking when you
see rank stupidity”
Cover Price: $6.99/issue
Domestic: $69.99/yr. (12 issues)
Canada/Mexico: $99.99/yr. Overseas: $129.99/yr.
(U.S. banks or money orders). Back issues: $12/ea.,
plus shipping and handling.
EDITORIAL OFFICES that is made to a document is recorded Remote Desktop for Two Monitors
SYS-CON Media 135 Chestnut Ridge Rd., and a history of changes is kept. This If you have two monitors at the
Montvale, NJ 07645
Telephone: 201 802-3000 Fax: 201 782-9638 may sound a lot like source control and, office, drag some of your windows
.NET Developer’s Journal (ISSN#1541-2849) is
published monthly (12 times a year) for $69.99 by in fact, it is. (like Solution Explorer) onto your
SYS-CON Publications, Inc.,135 Chestnut Ridge Road,
Montvale, NJ 07645. There are two important differ- second monitor, and then try to
Postmaster: Send address changes to: ences. The first is that, whereas source Remote Desktop into your worksta-
.NET Developer’s Journal,
SYS-CON Publications, Inc., control specializes in storing multiple tion when you get home. You will dis-
135 Chestnut Ridge Road
Montvale, NJ 07645 historical versions of a given document cover that Remote Desktop only gives
Copyright © 2004 by SYS-CON Publications, Inc. at a central location where multiple you access to your primary monitor
All rights reserved. No part of this publication may be reproduced or
transmitted in any form or by any means, electronic or mechanical, developers can access them via a check- and that it is very hard to get back
including photocopy or any information storage and retrieval system,
without written permission. For promotional reprints, contact Reprint in/check-out process, change tracking the windows that are on your second
Coordinator Dorothy Gil, dorothy@sys-con.com.
Worldwide Newsstand Distribution in Microsoft Word doesn’t do any of this. monitor.
Curtis Circulation Company, New Milford, NJ
Newsstand Distribution Consultant: It just stores additional metadata in a
Gregory Associates / W.R.D.S.
732 607-9941 - BJGAssociates@cs.com single, local copy of a document. Mock Environment Generator/
For list rental information:
Kevin Collopy: 845 731-2684,
The second difference – which is Automatic Expand-and-Collapse-All
kevin.collopy@edithroman.com;
Frank Cipolla: 845 731-3832,
what I would like to see added to Visual for Solution Explorer
frank.cipolla@epostdirect.com
Studio to work in conjunction with I lump these two together at the end
All brand and product names used on these pages are trade names,
service marks, or trademarks of their respective companies. SYS-CON
Publications, Inc., is not affiliated with the companies or products
source control – is the way in which because I am aware of third-party solu-
covered in .NET Developer’s Journal. .NET and .NET-based marks are
trademarks or registered trademarks of Microsoft Corporation in the United
these historical changes are displayed. tions that do both of these things. I’m
States and other countries.
By looking at a document in Word that cheap, though – so I’d like it for free “in
SYS-CON Publications, Inc., reserves the right to revise,
republish and authorize its readers to use the articles is under change control, I can instantly the box.”
submitted for publication.
see (via annotations in the margin) who What tools would you like to see as a
made changes to each bit of it, when part of Visual Studio .NET? Let me know
they changed it, etc. Wouldn’t it be great at derek@sys-con.com!
10 4
MCAD/MCSD MCAD/MCSD Group Publisher
Self-Paced Training Guide Jeremy Geelan jeremy@sys-con.com
Training Kit: (70-320): ADVERTISING
Developing Developing Senior Vice President, Sales and Marketing
Web XML Web Carmen Gonzalez carmen@sys-con.com
Applications Services and Vice President, Sales and Marketing
with Microsoft Visual Basic Server Components with Miles Silverman miles@sys-con.com
Advertising Director
.NET and Microsoft Visual C# Visual C# .NET and the .NET
Robyn Forma robyn@sys-con.com
.NET, Second Edition Framework Advertising Sales & Marketing Manager
by Microsoft Corporation by Amit Kalani Dennis Leavey dennis@sys-con.com
3
Advertising Sales Manager
9
Microsoft MCAD/MCSD Megan Mussa megan@sys-con.com
Visual Basic Training Guide Associate Sales Managers
Dorothy Gil dorothy@sys-con.com
.NET Step by (70-315):
Kim Hughes kim@sys-con.com
Step – Version Developing
2003 and PRODUCTION
Implementing Production Consultant
Jim Morgan jim@sys-con.com
by Michael Halvorson Web Applications with Visual
Lead Designer
C# and Visual Studio.NET Tami Lima tami@sys-con.com
by Amit Kalani Art Director
8 Applied
Microsoft .NET
Framework
Programming 2
Programming
Microsoft
Visual Basic
Alex Botero alex@sys-con.com
Associate Art Directors
Louis F. Cuffari louis@sys-con.com
Andrea Boden andrea@sys-con.com
Video Editor
.NET Version Frank Moricco frank@sys-con.com
2003 (Book & WEB SERVICES
by Jeffrey Richter CD-ROM) Information Systems Consultant
by Francesco Balena Robert Diamond robert@sys-con.com
Web Designers
6 Programming
ASP.NET
SYS-CON EVENTS
President, SYS-CON Events
1
MCAD/MCSD Self-Paced Grisha Davida grisha@sys-con.com
National Sales Manager
Training Kit: Microsoft
Jim Hanchrow jimh@sys-con.com
.NET Core Requirements
SUBSCRIPTIONS
by Microsoft Corporation
201 802-3012
by Jesse Liberty 888 303-5282
subscribe@sys-con.com
CUSTOMER RELATIONS
5
Developing Circulation Service Coordinators
Application Edna Earle Russell edna@sys-con.com
Frameworks in Linda Lipton linda@sys-con.com
JDJ Store Manager
.NET
Brunilda Staropoli bruni@sys-con.com
by Xin Chen
i
am sure that most of developer to write any JavaScript to rendered as a div tag on the page.
you have heard about or accomplish most of the Google Map Once you have the map, it is pos-
have had a chance to use functionality. sible to add controls to the map.
Google Maps. It’s a great Some of the available controls are
service and I was really impressed Some Google Maps Basics the GMapType control that helps to
by the responsiveness of the appli- Before we get into the details of toggle between the different views,
cation and the ease with which the ASP.NET control, let’s look at the namely map view, satellite view,
users could drag and zoom maps basics of the Google Maps API. A and finally, the hybrid view that is
from a Web browser. It has in many detailed description of the API can a combination of map and satel-
ways heralded the arrival of AJAX be found at www.google.com/apis/ lite views. The other controls that
(Asynchronous JavaScript and XML), maps/documentation/. The first are usually seen on the map are
which I am sure will revitalize Web step before using Google Maps is to the ones used to add scrolling and
development in the days to come. register for a key with Google (www. zooming capability to the map. At
What makes the service even bet- google.com/apis/maps/signup. the time of writing of this article,
ter is the availability of the Google html). This is absolutely free and there are three different controls
Maps API (Application Programming hardly takes a few minutes. Each available:
Interface) as a free Beta service. The Web site that uses Google Maps has • GLargeMapControl: A large con-
API allows developers to embed to have its own key. Make sure that trol for scrolling and zooming
Google Maps in their custom you go through Google’s Terms of • GSmallMapControl: Similar to
applications. It also allows them to Use (www.google.com/apis/maps/ the previous one, but eliminates
overlay information on the map and terms.html) before you start using the zoom scale bar
customize the map to their needs. Google Maps in your application. • GSmallZoomControl: Includes
As I write this article there are quite Google represents an instance only Zooming controls
a few sites that utilize Google Maps, of the map as a “GMap” object. It is
and more and more of them are Once the map has been set up, it
BY JEEVAN MURKOTH appearing by the day. is possible to overlay information on
The API by itself is pretty the map. The information can be in
straightforward and easy to use; the form of points or lines, though
however, it requires the developer to points are the most common ones.
have a good command of JavaScript In order to overlay a point on the
because it extensively relies on cli- Google Map, it’s necessary to know
ent-side Java scripting. In this article its longitude and latitude. At this
we will be looking at building a time, Google does not provide any
custom ASP.NET server control that geo-coding services that give the
would allow a .NET developer to co-ordinates corresponding to an
harness the power of Google Maps address, but there are a couple of
in the code-behind model. We will free services available on the inter-
see how to accomplish most of the net that do so. www.Geocoder.us is
functionality exposed by Google one of them and given a US address,
Maps using this control, and we’ll it returns the longitude and latitude
also see how to data bind the con- for the same. Once the longitude
trol, thereby allowing developers to and latitude have been obtained,
easily build data-driven custom ASP. create an instance of a GPoint
NET Web applications. The control f1 Figure 1: GMap control on the toolbar (which is Google’s representation
would eliminate the need for the in Visual Studio .NET of a point on the map), then create
f2 Figure 2: Output in the Web browser for Listing 2 f3 Figure 3: Output in the Web browser for Listing 3
a GMarker using this point and add more of a .NET wrapper around the the shadow associated with the
the marker to the instance of the Google API; however, because it is icon; IconSize and ShadowSize
Google Map. In order to Center and a full-fledged ASP.NET server-side represent the size of the icon
Zoom on a point, the GMap Object control, it is possible to bind data and the shadow, and the last two
exposes a method ZoomandCenter to the control, thereby increasing properties are IconAnchor and
that takes the point and the level of the usability of Google Maps. In the InfoWindowAnchor, which specify
zoom required as the parameter. Just following sections we will see how the point where the icon should
like points, it is possible to overlay to use this control to implement be anchored to the map relative
lines on the Map. Those of you who most of the common functionality to its top-left corner and the point
have used Google Maps for direc- of Google Maps. Before we do so, where the Info window should be
tions will be familiar with the lines let’s take a look at the control. The anchored to the map.
used to depict the route. In order principal class of the control is the • GLine: This is a line that the user
to add a line to the Google Map, “GMapControl” class. This class in wishes to overlay on the map.
we need to create an instance of turn references the following classes By default it takes a collection
a GPolyLine object and pass in an (most of these classes are the .NET of points (GPoints) as an argu-
array of GPoints to plot it. It is also equivalents of the classes used by ment in its constructor. It is also
possible to assign color, width, and Google): possible to set the color of the
opacity to the line. Another useful • GPoint: This is the class represen- line as well as its weight and
feature in Google Maps is the ability tation of a geographical point and opacity through an overloaded
to show a pop-up window when the exposes latitude and longitude as constructor.
user clicks on a Marker. Google Calls its two properties. • GMarker: This is the .NET repre-
this pop-up window by the name • GPoints: This class represents a sentation of the Google Maps class
“InfoWindow.” collection of GPoint objects. GMarker. The default constructor
• GIcon: Represents a custom accepts an instance of a GPoint
The Google Maps ASP.NET icon that is used as an overlay class. It also has an overloaded
Control (GMAP Control) on the map. The GIcon class constructor that takes a GIcon
The main aim of this control is exposes the following proper- along with the GPoint in case the
to allow .NET developers to utilize ties: the Image URL, which as the developer wishes to use a custom
the functionality of Google maps as name suggests, is the URL of the icon to represent the marker.
a server-side control by writing little image used to represent the icon; • GSize: Represents a two-dimen-
to almost no JavaScript at all. It is ShadowImageURL is the URL of sional size measurement.
f4 Figure 4: Output in the Web browser for Listing 4 f5 Figure 5: Output showing the custom markers
• JScriptGenerator: This is an inter- you want the page to render the Adding to the Toolbar
nal class and has more of a helper GMAP control properly in other This step is optional; however if
function. It generates most of browsers such as Netscape and you are using Visual Studio .NET as
the JavaScript functions that are Firefox, include the browser cap your IDE, I would recommend that
needed by the control. section shown in Listing 1 into you go ahead and add the GMap
• HelperColorConvertor: This class the Web.config file of your control to your toolbox. The advan-
is used to convert a color into its application. tage of doing so is that you can easily
equivalent Hex value. This class is drag and drop the GMap control
marked as internal. Page Configuration onto an ASPX page like any other
• HelperDataResolver: This is an Google has certain recommen- ASP.NET control, and Visual Studio
internal class that helps in data dations for the HTML standards will automatically register the con-
binding and has just one method. on pages that contain the map to trol on your page. Figure 1 shows the
The method casts a datasource make sure that the layout is pre- GMap control on the toolbar.
object into an object that imple- dictable across different browsers.
ments the IEnumerable interface. A detailed description of the same Creating a Basic Map Using
The help file that describes in can be found in the Google maps the Control
detail the different methods and documentation. It is imperative Since we are done with the setup,
properties of the classes involved that you follow these standards, let’s go ahead and create a simple
is available as a download. especially if you plan to overlay example using the control. We will
lines on your map. For lines to be add the GMap control to the page,
Getting Started in ASP.NET rendered on the map, you need to set its dimensions, and make it cen-
Before we use the ASP.NET con- include the VML namespace in the ter and zoom at a particular point.
trol in our application, there are a HTML page for Internet Explorer For the sample application used in
few things that need to be taken browsers. Make sure that you don’t this article, I have saved the map key
care of to ensure that it works as forget to do this, because otherwise in the Web.config file and will be set-
desired. the lines will not be displayed in ting the GoogleMapKey property of
Internet Explorer. The HTML tag of the control from the config file. I will
Web.config File your page should at the minimum be setting the map type of the con-
The GMAP control renders itself look like the snippet below: trol to be that that of “Map.” In case
as a DIV tag, however for non– no map type is specified, the control
Internet Explorer Browsers, ASP. <HTML xmlns:v=”urn:schemas-micro- defaults to the preset “Map.” The
NET renders the div tag as tables. If soft-com:vml”> GMap Control also supports satellite
Security should never be an inhibitor to new opportunity: Forum XWall™ Web Services
Firewall has been enabling Fortune 1000 companies to move forward with XML Web
services confidently. Forum XWall regulates the flow of XML data, prevents unwanted
intrusions and controls access to critical Web services.
Visit us at www.forumsys.com to learn more about how you can take your next leap
forward without increasing the risks to your business.
fo r u m syst e m s ™ – t h e l e a d e r i n we b s e rv i c e s s ec u r i t y ™
ASP.NET
f6 Figure 6: Rendering of the line in the browser f7 Figure 7: Multiple Google Map controls – output
and hybrid map types. Make sure Overlaying Markers and Pop-Up icon with any custom icon that we
that you center and zoom at a point, Windows specify. The same functionality is
otherwise all that will show up will Another cool feature of Google provided by the GMap ASP.NET con-
be a grey area. Listing 2 shows the Maps is the ability to display mark- trol. In order to do so, we need to
code for this example and Figure 2 ers on the map and attach pop-up define a GIcon class with at least the
shows the output. windows to these markers on the following properties:
click event. It is possible to dis- • URL of the image that would rep-
Setting the GMap Control play formatted HTML containing resent the GIcon
Properties links and images in these pop-up • URL of the shadow image
Let’s go ahead and set some windows. Let us see how to do • Size of the image
properties to the basic example the same using the GMap ASP. • Size of the shadow
we just created. The GMap control NET control. Let’s take the previ- • The point at which the icon is to
exposes a set of properties that ous example and modify it to add be anchored to the icon
allows the developer to customize two markers. One would be a plain
the control to his or her needs. If marker and the other would have In case info windows are used,
we wish to give the user the flex- a pop-up window that would dis- it is also necessary to specify the
ibility to change the view, we set play some text. The GMap ASP.NET point where the info window is to
the ShowMapTypeControl property control has an overloaded method be anchored to the map. For this
of the control to true. By default, called OverlayMarker that takes the example we will be borrowing the
the user is able to drag the map, formatted HTML as a string param- icons from the Google Ride Finder
however, if we do not wish the eter. If the overloaded method is application. Let’s take the same two
user to drag the map around, we called and some HTML is passed points that we used in the marker
can set the EnableDragging prop- to the method, a click event is example and replace the standard
erty to false. To allow the user to automatically passed to the marker marker icons with these custom
be able to scroll or zoom, set the and the info window is displayed. icons. The code in Listing 5 is same
ScrollControlType property of the Listing 4 shows the code to overlay as that of Listing 4, except for the
control. There are three different two markers and Figure 4 shows the use of custom icons. Figure 5 shows
options: “large,” “small,” and “zoom output of the same. the output.
only,” to correspond to the controls
offered by Google. Listing 3 shows Overlaying Custom Markers Overlaying Lines
the source code and Figure 3 shows Google gives us the flexibility In this section we will see how
the output in the browser. to replace their standard marker to overlay a line on a Google Map.
���������������������������������������
��������������������������������������������
��������������������������������������������
�������������������������������������������������������
������������������������������������������������������������
��������� � ����������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������� ������ �
���������� ������������ �����������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������������������
������������������������������������� ����������������������������������������������������������������������������������������
�������������������������������������������� ����������������������������������������������������������������������������������
��������������������������������
������������������������������������������������������������������������������������������������������������������������ ���������������������������������������������������������������������� ���������������������������������������������������� ������������������������������������������������������������������������������
� � � � � � � � � � � � � � � � � � � �
� � � � � � � � � � � � � � � � � � � �
SQL Server 2005
o you love XML? Have it ever was before. I’ve found that elements, in turn, contain multiple
���������������������
�����������2�3�������
������������������������
����������
������������������������������������������������������� ������������
�������������
����������������������������������������������������� �������
���������������������
���������������������
��������������
���������������������������������������������������������� ������������
���������� �����������������
������������������������������������� ����������������
���������
�������
������������������������
���������
����������������������������������������������� ���������������� ������������������
������������������������������� ������������������
���������������������
�������������
����������������
����������������������������������������������������������������� ������������
���������������� ����������������
������������������������
��������������������������������������������������������������� ������������������ �����������������������
������������������������ ������
�����������������������������������������������������������������������
����������������������������������������������������������������
���������������������������������������������������������������������������������
��������������������������������������������������������������������� ��������������������������
�����
������������������������������������������������������������������������
� � �
� ���������� ���� ��������������������������������������������������
��������������������������������������������������������������������� ������
���������������������������
��������������������������������������������������������������������� �������
��� ������� �������������������������������������������������������
��
����� ���
���������������������� �������������
���
�����
�����
� � ������
�����������
�������������
���������������������������������
� �
������������������
� ������������
COPYRIGHT ©2006 SYS-CON MEDIA ALL RIGHTS RESERVED NOTE: SPEAKER LINE-UP SUBJECT TO CHANGE WITHOUT NOTICE
���������
���
�����������
Performance
i
ere’s a question: If you write delete operations on multiple tables. ArrayList collection of components.
your application’s code in (Source code for this article is avail- Members of the components col-
an OO language – such as able from www.everylittlething.net/ lection are required to assemble this
C#, VB.NET, or managed PartsAssembly/.) PartAssembly.
C++ – why not write database query If we strip away the method defini-
and update code in the same language? Illustration by Example tions for these classes, the structure
It would certainly make life simpler, Suppose you must write an applica- becomes transparently obvious (see
wouldn’t it? At the very least, you’d only tion for an assemblies database – that Listing 1). When implemented in a
have to hold one language in your head is, a database whose content tracks relational database, the class structure
– not your programming language and items that are assembled from “parts.” in Listing 1 would require two or three
SQL. A “part.” in this case, could be just tables, depending on how a person
That’s the very least of the advan- about anything: a screw, a light bulb, a modeled the inheritance relation.
tages you’d gain by choosing an OO spring, or even a software component. In a three-table arrangement, Part
database instead of an RDBMS. The It doesn’t really matter: the idea is that objects would be stored in one table,
metaphor “impedance mismatch” assemblies are constructed by connect- PartAssembly objects in a second,
has frequently been used to illustrate ing parts together, and in turn, more and the contents of the components
the problems that arise from using a complex assemblies can be fabricated ArrayList in a third. (This kind of map-
relational database as the back end to by connecting assemblies together. ping from OO to relational is referred to
an OO application. Admittedly, it’s a The aggregation of lower-level as “horizontal mapping.”) The column
somewhat overused metaphor, but it assemblies continues until a top-level structure of the Part and PartAssembly
still serves its purpose. It illustrates the assembly (or a “finished product”) tables would be identical, because the
fact that relationships among objects is reached. Therefore for example, a only difference between the two – the
– referencing, containment, polymor- motherboard assembly – consisting of components element in PartAssembly
phism, and so on – must be translated circuit board, CPU, and memory part – would be stored in the third table. The
into relational constructs when those objects – is combined with a power- components dictionary table would
objects are stored in the database. supply assembly, a disk-drive assembly, hold two columns, one for the Part, and
Furthermore, the translations require and a chassis assembly to create a desk- a second to reference the PartAssembly
BY RICK GREHAN developer intervention at some point: top system. This structure is illustrated identifier. This second column is a for-
either explicitly in executable code, by in Figure 1. eign key, and provides the connection
creating schema mapping files that a This kind of database is nicely between the components and their
translation layer reads and interprets, or portrayed in an object-oriented struc- “owning” PartAssembly object.
through some other mechanism. ture. The Part class is the fundamental In a two-table solution, Part and
The upshot is that you have to building block. From it, one derives a PartAssembly would share the same
“explain” the object structure of your PartAssembly class (which models an table (this is known as “filtered map-
application to a relational database Assembly from Figure 1, but which we ping”). That table would include
AND ERIC FALSKEN – and in terms that the relational data- renamed in order to sidestep any con- columns for category, name, manufac-
base understands. Sometimes this even fusion with .NET’s meaning of the word turer, and manufacturerPartNumber.
requires you to add elements to one or “assembly”). The PartAssembly class An extra column would be added – call
more of your objects – elements that extends the Part class by adding an it classID – that would be used to dis-
translate to additional columns in one tinguish rows that correspond to Part
of the RDBMS tables, and serve no objects from rows that correspond to
purpose other than to support object Assembly PartAssembly objects.
relationships. The advantage of the three-table
Specifically, suppose you have an mapping strategy is its conceptual sim-
OO application whose objects’ struc- plicity. Each concrete class gets its own
Assembly Assembly
tures exhibit a tree-like or networked table. It is also more easily extended. If,
arrangement. With regard to entities for example, a new class were defined
that your program can treat as a single Part Part Part Part Part that extended PartAssembly, the devel-
(albeit complex) object, the back-end oper would need only to construct a
RDBMS must distribute across multiple f1 Figure 1: The structure of the new table.
rows and (likely) multiple tables. For assembly database fits nicely into On the other hand, the two-table
example, deleting a single tree – which object-oriented grooves. Parts strategy has the advantage of minimiz-
in OO code would be the mere drop- belong to assemblies, and both are ing the number of tables required.
ping of a reference – turns into multiple derived from the same base class. However, adding a new descendant
�� ���������������������������
�������������������������
� �������������������������
� �������������������
� ������������ �
���������������������������������2�3���� ���������������
�� ��������������������������������������������
��������������������������� ��
��
�����������������������
���������������������������
�� ��������������������������������������������
�� ������������
���������������������� ��
��
�������������������������������������������������
����������������������������
������������������������������������������������� �� ��������������������
���������������������������������������������������������������� �� ������������
�� �������������
�������������������������������������������������������������������������������������������������������� �� ����������������������������������
�������������������������������������������������������������������������������������������������������� �� ���������������������������
������������������������������������������������������������������������������������������������� �� �����������������������
��������������������������������������������������������������������������������� �� �����������������
�� �� ����������������������������������
��������������������������������������������������������������������������������������������������������� �� �������������������������������������
������������������������������������������������������������������������������������������������� �� �������������������������������
���������������������������������������������������������������������������������������������������������
�����������������������������������������������������������������������������������������������������������
���������������������������������������������������������� �������� ����������������������������������
ALL RIGHTS RESERVED
� ��������������������������
�����������������������������������������������������������������
�������� ����������������������������������
���������������������������������������������������������������������� � ����������������������������
��������������������������������
�� �������� ����������������������������������
COPYRIGHT ©2006 SYS-CON MEDIA
������������������������������������������������������������������ � ���������������������������
�������������
������������������������������������������������������������������������� �������� �����������������������������������������������
����������������������������
������������������������������������������������������������������ � ����������������������������������������������
������������������
������������������������������������������ �� ����������������������������������������������
����������� � ����������������������������������������������
Performance
had occurred since the last commit() or
Part Table PartAssembly Table
open() would be rolled back.
category name manufacturer manufacturerPartNumber category name manufacturer manufacturerPartNumber Retrieving an object from this OO
memory PC-2 5400 DDR Generic 25400 DDR Desktop Sys. Desk Mod 01 My Computers DTM0D01
database is just as easy as storing it. We
cpu Pentium 4 Intel BX8O547PG32OOF
hard drive DiamondMax Maxtor 6Y25OMO6Y25OMO don’t have to assemble an object’s “piec-
Components Table es” from multiple tables; instead, we can
parent part pull it from the database with a single
DTMODO1 PC-2 5400 DDR call. All we need is a query mechanism
(a) DTMODO1 Pentium 4 to identify the specific object we want.
DTMODO1 DiamondMax db4o provides this mechanism via
its QBE (query by example) API. QBE,
as implemented by db4o, is an easy-
PartAndAssembly Table to-understand query technique that
uses a template object to define the
class category name manufacturer manufacturerPartNumber
P memory PC-2 5400 DDR Generic 25400 DDR
query. We fill the template object’s fields
P cpu Pentium 4 Intel BX8O547PG32OOF with those values we want the query to
P hard drive DiamondMax Maxtor 6Y25OMO6Y25OMO match. Fields that should not partici-
A Desktop Sys. Desk Mod 01 My Computers DTMOD)1 pate in the query are set to null or zero
(depending on the datatype).
Therefore, if we wanted to fetch
the Part object we had just stored into
Components Table the database, we could use the code
in Listing 3. The query in Listing 3
parent part
(b) matches all Part objects whose name
DTMODO1 PC-2 5400 DDR
field is “Desktop Board D945GNT” (we
DTMODO1 Pentium 4
presume there is only one). Matching
DTMODO1 DiamondMax
objects are placed in the ObjectSet
result. The ObjectSet class provides has-
f2 Figure 2: Two techniques for mapping objects to relational databases. (a) Each class receives its own table.
Next() and next() methods, which allow
The components collection (in the PartAssembly class) is stored in a separate table, with a foreign key reference
navigation-through-iteration on the
back to the “parent” item in the PartAssembly table. (b) Both Part and PartAssembly classes are stored in a
set’s contents.
single table. A column is added to identify the class to which a particular row of data belongs.
The query fetched a Part object
from the database. As defined, the
class to either Part or PartAssembly .NET and Mono versions of db4o are Part object is relatively “simple” – that
(with new data members) would freely available from www.db4objects. is, it contains only strings as member
require adding new columns to the com. variables. The PartAssembly class,
table, as well as new logic to identify the Assuming that we have defined the however, contains a collection, and that
additional class type. Part and PartAssembly classes as above, collection contains objects. One would
and that the path to our database file is expect that fetching a PartAssembly
Simplicity Calls in string variable filename, we can store object – collection and all – would be
Wouldn’t it be nice if all this discus- Part objects into a db4o database with more difficult.
sion of mapping strategies were unnec- the code in Listing 2. Actually, it is only slightly more
essary? As we’ve stated already, this sort This is more like it. Rather than difficult. Although db4o lets us pull
of class structure is easily modeled in clutter our application with SQL code an entire object tree into memory, we
an OO language. It follows that the ideal flanked by assignment statements might not want to. For example, we may
situation would be if that easy modeling that pass object contents into bind want to fetch one or more PartAssembly
were simply extended to the database. variables, we have a single call to a objects from the database, without
Put another way, our object structure’s set() method. Most important: notice fetching the contained collection.
schema is built into the very architec- that we did not have to describe the We can control how “deeply” db4o
ture of our class definitions. Why should structure of a Part object to the db4o reaches into an object tree (when it
we have to create yet another schema database engine; it deduced that infor- retrieves a complex object from the
for the back-end database, and then mation itself, via reflection. database) by adjusting db4o’s “activa-
build a mapping layer to translate data Also notice that db4o invisibly tion depth.” By default, the activation
from one schema to another? Wouldn’t began a transaction for us. The db4o depth is set to 5, which means that
it be nice if we could simply design our engine supports the ACID database retrieving a PartAssembly object would
classes, write our application, and store concepts (atomicity, consistency, isola- also retrieve the collection. (So, fetch-
objects right into the database “as-is”? tion, and durability). We need merely ing a whole PartAssembly would use
With an OO database, we can. close the transaction with a call to code that is virtually identical to the
For the remainder of this article we’ll commit(). Had something gone awry code in Listing 3.) To retrieve only the
demonstrate how to do this by using an during the transaction, we could have PartAssembly – without the compo-
open source database, db4o. Microsoft called abort(), and all operations that nents collection – we can set the global
Listing 2
// Open the ObjectContainer Listing 4
ObjectContainer Database = Db4o.OpenFile(fileName); // Create a Part template object
Part PartTemplate = new Part (
// Create a new Part object null,
Part mb = new Part ( “Motherboard”, “Desktop Board D945GNT”,
“Desktop Board D945Gnt”, null, null, null);
“Intel”,
“BOXD945GNT”); // Execute the query
ObjectSet result = Database.get(PartTemp);
// Put it in the database
Database.set(mb); // Retrieve the matching object
if(Result.hasNext()) {
// Commit the transaction and Part mb = (Part) result.next();
// close the database
Database.commit(); // Update the alternateSupplier
Database.close(); mb.AlternateSupplier = “Dougs Board Outlet”;
o
ne underutilized tech- being developed. Much of this can model is that our control inherits
nique for maximizing of course be copied and pasted from System.Web.UI.WebControls.
code reuse and increas- from one application to another, CompositeControl (see Listing 1).
ing developer produc- but when changes occur, these In previous versions of the .NET
tivity is the creation and utilization changes must then be made in Framework, you inherited from
of ASP.NET Server controls. Even multiple applications. An example Control and had to implement
when the problem domain is well of this type of change would be the INamingContainer interface.
known and understood, each to an address for a company that These steps, along with other
new project has many developers has recently gone international functionality, are now taken care
starting at square one, dragging and now must start capturing the of by the CompositeControl base
and dropping the common Visual country where their customers class. The CompositeControl class
Studio.NET controls onto a blank are located. By utilizing a server also has an associated control
form and having to manually control, the display and client-side designer that ensures that child
repeat the same processes that logic to handle this new data can controls are displayed on the
other developers in the company be coded once, with developers design surface.
have had to perform in the past. now focusing on updating the busi- You will also notice several attri-
Server controls are an in-depth ness logic. butes attached to the class defini-
topic and it would take an entire The server control in our tion. These help define various
book to do the subject justice. example creates a simple user characteristics of our control:
In this article I will explain the interface (UI) for entering phone • AspNetHostingPermission: This
basics of how to create a type of numbers. It is composed of a is required to ensure that code
server control called a Composite Label control, a TextBox control, that links to the control has the
BY WES WEEKS control, and to highlight some of and two validator controls: one is appropriate security permissions
the differences between ASP.NET a RequiredFieldValidator and the • DefaultProperty: Specifies the
1.x and ASP.NET 2.0 server con- other is a RegularExpressionValida property to highlight in the
trols. (Source code is available by tor. One of the advantages of using property browser when the page
viewing this article online in the composite controls is that you developer selects the control on
.NETDJ archives, http://dotnet. can utilize the ASP.NET controls’ the design surface
sys-con.com/read/issue/archives/, built-in behavior to minimize the • ToolboxData: Used to specify
[Vol: 4, iss: 1].) amount of code you have to write. the format string for the design
For example, you will be able to environment created when the
The Case for Server Controls utilize the validator controls to per- control is added to a page
Most businesses have certain form their native functions without
sets or types of information that having to write any control-specific Define Composite Control
are ubiquitous to most of the code. Properties
applications being developed. The next step in our compos-
Addresses, phone numbers, and Defining a Composite Control ite control is to define the public
customer names are just a few One of the first things you properties that will be accessible
examples of common input col- will probably notice if you are via the property browser in Visual
lections that are often duplicated familiar with developing server Studio.NET. Most of the proper-
each time a new application is controls under the ASP.NET 1.x ties are a direct pass through to
Listing 1 Listing 2
[AspNetHostingPermission(SecurityAction. [Bindable(true),
LinkDemand, Category(“Behavior”),
Level = AspNetHostingPermissionLevel.Minimal), DefaultValue(“”),
DefaultProperty(“Text”), Description(“Validation Group the control
ToolboxData(“<{0}:PhoneControl runat=\”server\”> belongs to”)]
</{0}:PhoneControl>”)] public string ValidationGroup
public class PhoneControl : CompositeControl {
{ get
private Label phoneLabel; {
private TextBox phoneTextBox; EnsureChildControls();
private RequiredFieldValidator phoneRequired; return phoneRequired.ValidationGroup;
private RegularExpressionValidator phoneRe- }
gex; set
private Style labelStyle; {
private Style phoneStyle; EnsureChildControls();
}
phoneLabel.ID = “phoneLabel”; }
Controls.Add(phoneLabel); }
writer.AddAttribute(HtmlTextWriterAttribute.
phoneRequired = new RequiredFieldValidator(); Cellpadding, “1”, false);
phoneRequired.ID = “phoneRequired”; writer.AddAttribute(HtmlTextWriterAttribute.Border,
phoneRequired.ControlToValidate = phoneTextBox.ID; “0”, false);
phoneRequired.Text = “*”; writer.RenderBeginTag(HtmlTextWriterTag.Table);
Controls.Add(phoneRequired);
if (labelStyle != null)
phoneRegex = new RegularExpressionValidator(); {
phoneRegex.ID = “phoneRegex”; phoneLabel.ApplyStyle(labelStyle);
phoneRegex.ControlToValidate = phoneTextBox.ID; }
phoneRegex.Text = “*”;
phoneRegex.ValidationExpression = @”(((\(\d{3}\) if (phoneStyle != null)
?)|(\d{3}-))?\d{3}-\d{4})|\d{10}|\d{7}”; {
Controls.Add(phoneRegex); phoneTextBox.ApplyStyle(phoneStyle);
} }
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
Listing 4
writer.RenderBeginTag(HtmlTextWriterTag.Td);
private void RenderJavaScript()
phoneLabel.RenderControl(writer);
{
writer.RenderEndTag();
if(!Page.ClientScript. IsClientScriptBlockRegistered(th
writer.RenderBeginTag(HtmlTextWriterTag.Td);
is.GetType(), “formatPhone”)
writer.Write(“ ”);
{ writer.RenderEndTag();
StringBuilder sb = new StringBuilder(); writer.RenderBeginTag(HtmlTextWriterTag.Td);
sb.Append(“function formatPhone(phoneTextBox){\r\ phoneTextBox.RenderControl(writer);
n”); phoneRequired.RenderControl(writer);
sb.Append(“\tvar text = phoneTextBox.value;\r\n”); phoneRegex.RenderControl(writer);
sb.Append(“\ttext = text.replace(/\\D+/g,\”\”);\r\ writer.RenderEndTag();
n”); writer.RenderEndTag();
sb.Append(“\tif(text.length == 10){\r\n”); writer.RenderEndTag();
sb.Append(“\t\t phoneTextBox.value = \”(\” + text. }
id you know that the termi- developers who may be purists, and
SUBSCRIBE ONLINE!
Regardless of their experience level, .NET
fully selected for their prime Developer’s Journal assumes that everyone
reading it shares a common desire to under-
technical content – technical www.sys-con.com/dotnet/ stand as much about .NET – and the busi-
ness forces shaping it – as possible. Our aim
details aren’t watered down with or Call is to help bring our reader-developers closer
OFF $83.88
Wholly independent of both Microsoft Corporation
6999
.NET and Web services, .NET Developer’s Journal
“According
to our worldwide network of software
development activists, evangelists, and executives,
2006 promises to be a vintage year for software development”
dotnetdevelopersjournal.com • January 2006
41
Tips & Tricks
l
In this article, we’re has a DataSet defined (ProductData) .BorderStyle =
going to look at how and a constant (PRODUCT_TABLE_ DefaultGridBorderStyle
DataWindow.NET technol- NAME). This particular VB.NET End With
ogy is a simpler but more example, unlike the last two we
powerful way of formatting data in looked at, is a typical ADO.NET The DataWindow implementa-
the presentation layer. sample that uses a DataAdapter and tion of ResetDemo is much simpler
We’ll be taking a sample appli- a DataSet to retrieve and store the because we only need to reset the
cation provided by Microsoft for data and then fill the DataGrid. The properties on the DataWindow
.NET and implementing it using PRODUCT_TABLE_NAME constant control. The properties of the
DataWindow.NET technology. In is used to name the result set of DataWindow object get reset during
this case, we’re using the Visual interest in the DataSet because a the BindDataWindow method when
Basic .NET Code Sample: DataGrid .NET DataSet can actually hold mul- we reassign the DataWindow object
Formatting sample application tiple result sets. to the control.
available at http://www.micro- Each of the command but-
soft.com/downloads/details. tons calls two form methods DataWindow ResetDemo
aspx?FamilyID=28fd458f-5571-42b4- (ResetDemo and BindDataGrid or dw_products.BorderStyle =
a2fe-09b69ddf0863&displaylang=en. BindDataWindow) and then a third DataWindowBorderStyle.None
The original sample was writ- form method for the non-default dw_products.TitleBar = False
ten to connect to the Microsoft styles that sets up that particular dw_products.Text = “”
Northwind sample database. So style (see Table 2).
you’ll need MSDE or SQL Server In the DataGrid implementation, Both the BindDataGrid and
with that sample database installed the ResetDemo method clears the BindDataWindow methods try to
if you want to try it out for yourself. DataSet and then resets each of the connect to the SQL Server version
Also, the sample code for this article various formatting properties that of the Northwind database and then
is intended as an addition to the get set during the demo. try to connect to the MSDE version
original sample so you can compare if the SQL Server version can’t be
them side-by-side. After adding the DataGrid ResetDemo found. The DataGrid implementa-
sample code files from this article If Not IsNothing(ProductData. tion then uses an SqlDataAdapter
to the original sample, you can Tables(PRODUCT_TABLE_NAME)) Then class to retrieve the data from the
switch between the DataGrid and ProductData.Tables(PRODUCT_TABLE_ database and routes it to the DataSet.
BY BRUCE DataWindow implementations by NAME).Clear() Then it assigns that DataSet as the
ARMSTRONG changing the startup form for the End If DataSource for the DataGrid control.
project (see Figure 1).
With grdProducts DataGrid BindDataGrid
Main Form .BackgroundColor = SystemColors. Dim ProductAdapter As New
The main form of the appli- InactiveCaptionText SqlDataAdapter( _
cation consists of a DataGrid or .CaptionText = “” “SELECT ProductID, ProductName,
DataWindow and four command .CaptionBackColor = SystemColors. UnitPrice, UnitsInStock FROM prod-
buttons that apply “Default,” ActiveCaption ucts”, _
“Table Style,” “Column Style,” and .TableStyles.Clear() northwindConnection)
“Grid Properties” formatting to the .ResetAlternatingBackColor() ProductAdapter.Fill(ProductData,
DataGrid or DataWindow control. .ResetBackColor() PRODUCT_TABLE_NAME)
Table 1 shows the results of the .ResetForeColor() grdProducts.DataSource = ProductData.
different formatting applied to .ResetGridLineColor() Tables(PRODUCT_TABLE_NAME)
the DataGrid and DataWindow .ResetHeaderBackColor()
respectively. .ResetHeaderFont() The DataWindow implementation
The primary difference between .ResetHeaderForeColor() of the BindDataWindow method does
the DataGrid and DataWindow .ResetSelectionBackColor() pretty much the same thing using
implementations with regard to .ResetSelectionForeColor() DataWindow related classes. First
form variables is that the DataGrid .ResetText() the OleDB connection is bound to a
GetRGB
Public Function GetRGB(ByVal theColor
As Color) As String
Dim theRGB As Long
theRGB = RGB(theColor.R(), theColor.
G(), theColor.B())
Return theRGB.ToString()
End Function
SetColumnBackColor
Public Sub SetColumnBackColor
(ByVal theColor As Color) t1 Table 1: DataGrid and DataWIndow formatting examples
Dim columns As ArrayList =
GetVisibleColumns() DataWindow object and I’ve added a For Each col In columns
Dim col As String method to the overridden control to MyBase.SetProperty(obj + “.Back
For Each col In columns make it simpler. Ground.Mode”, “0”)
MyBase.SetProperty(obj + rc = MyBase.SetProperty(col +
“.BackGround.Mode”, “0”) SetRowAlternatingColors “.Background.Color”, modify)
MyBase.SetProperty(col + “.Back Public Sub SetRowAlternating Next
ground.Color”, GetRGB(theColor)) Colors(ByVal OddColor As Color, End Sub
Next ByVal EvenColor As Color)
End Sub Dim columns As ArrayList = Similar to the issues with the .NET
GetVisibleColumns() system colors, the .NET Framework
One of the color settings that the Dim col, modify As String Font is a class whereas the DataWindow
DataWindow control doesn’t provide Dim rc As Int32 has a series of independent font prop-
native support for is to have alternating modify = GetRGB(OddColor) + _ erties. The Font setting methods I’ve
rows appear with different background ~tif ( MOD( getrow(),2 )=0 ,” + added to the subclassed DataWindow
colors. That’s done easily enough by GetRGB(EvenColor) + “,” + control accept the .NET Framework
adding a property expression to the GetRGB(OddColor) + “)” Font class and then access the indi-
Advertiser Index
ADVERTISER URL PHONE PG
.N
ET 2.0 Generics is my cute generics, and shows how the
favorite book of 2005. use of generics affects code speed
Well, other than Harry and size.
Potter anyway. This book There are three chapters in
is not for new programmers. To this book from which I expect to
understand this book, I would get heavy use as a reference on
recommend that you have about a a day-to-day basis. The first is a
year of programming experience, chapter on BCL generics, or the
and at least six months with C++, generic classes that come with the
C#, or Java. This book is well writ- .NET Framework. Most of these are
ten and is best used as an introduc- container classes, and this chapter
tion to generics, so it is of most covers how they work, including
use to an advanced beginner. The how to add, access, and remove
reader should be familiar the syn- items to each type of generic collec-
tax of a C-derived language such as tion. The second chapter I expect
C++, Java, or C# 1.x, and be familiar to reference almost daily covers the
Title: .NET 2.0 Generics
with object oriented-programming “Power Collections” sponsored by
Author: Tod Golding
issues such as inheritance, over- Wintellect at www.Wintellect.com.
Publisher: Wrox
loading, and overriding. No knowl- There are several open source proj-
edge of generics is needed to make ISBN #: 0-7645-5988-5 ects creating generic collections for
use of this book. Price: US $39.99 .NET (as well as a lot of private com-
On the other hand, unless you panies doing the same). Of these,
are a wizard with .NET generics, pointed out that the complexity Power Collections is one of the
you are likely to learn a lot from of templates in C++ has to some larger and better known, and they
this book. For example, C++ pro- extent given generics a bad name, also work closely with Microsoft
grammers: What is the difference and how generics, although not (rumors are that the best and most
between templates and generics? quite as powerful as templates, popular of the Power Collection will
The easy answer is that templates keep some of this complexity at be included in future versions of the
work at compile time, and gener- bay. It then covers simple generic .NET Framework). There is a long
BY DENNIS HAYES ics work at run time, but there is classes and follows up with chap- chapter at the end of the book that
a short chapter that details the ters on generic methods and covers the Power Collections in the
Dennis Hayes is an independent real differences. Although most of generic delegates. It also covers same way the earlier chapter covers
software consultant in Atlanta, GA, the book concentrates on C# and constraints, which allow only types the current .NET generics.
and has been involved with the VB.NET, there are two chapters that with certain attributes or capabili- The third chapter that will get
Mono project for over three years. detail the nuances of using gener- ties to be added to the collection. continued use from me is a set of
ics with C++ and J#. The C++ chap- An example is a generic container rules and principles to apply when
4dennisdotnet@yahoo.com ter also discuses how to combine that is meant to hold data table creating your own generic classes.
templates and generics together to objects, and is given constraints A key premise of this book is that
get the best of both worlds, and has that require any object added to it generics are so powerful that you
a short discussion on the STL.NET to have sort and update methods. should not only use the ones pro-
library that actually makes use of The book also contains an vided by Microsoft and others, but
the combination. advanced chapter on how generics you should also create new ones as
The book starts off discuss- can be created or analyzed using a part of all of your applications,
ing the way collections in .NET reflection, how they are serialized just as you do classes. The rules
1.1 work by having members be and deserialized, and how they work in the Generics guidelines chap-
objects, and how the need to cast with remoting and Web services. ter distill a lot of experience with
types to and from objects clutters For those who want to know generics and can help programmers
and complicates programs. It then what is happening “under the avoid many of the most common
shows how generics can clean up hood,” this book has a chapter that mistakes.
the clutter and make programs gives details on how compilers and This is a must-have book for
clearer and more flexible. It is also the run time implement and exe- anyone using .NET 2.0.
������������������������� �������������������������
������������������������ ������������������������
������������������������������������������������������������������������������ �������������������������������������������������������������������������
����������������������������������������������������������������� ���������������������������������������������������������������������������
����������������������������������������������������������������������� �����������������������������������������������������������������������
������������������������������ ����������������������������������������������������������������������������
�������������������������������������������������������������������������
������������������� ����������������������������������������������������������������������������
����������������������������������� ������������������������� ��������������������������������������������������������������������������������
������������������������ ������������������� ����������������������������������������������������������������
������� ������������������
��������������� ���������� �������������������
����������� ��������������������������
��������������������������� ��������������������� ���������������������� ���������
��������������������� ���������������� ���������������������� �������������������
������������������������� ���������������� ����������� ����������������������������
������������������������� ����������������������������� ������������������ ������������������������������
�������������������������� ���������������������������� ����������������������� ����������������
���������������������������������������� �����������������
�������������������������events.�����������
������������
� ������������������������������
� �������� �������������������������������
��
� � �������������������������
��
� � ��������������������
������������������������events������������ � � �����������������������
����������������������������������������
� ���������������23 �����������
© 2005 WEB SERVICES EDGE. ALL RIGHTS RESERVED
Mono