Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

MSDN Magazine February 2011

Download as pdf or txt
Download as pdf or txt
You are on page 1of 158
At a glance
Powered by AI
The magazine covers various topics related to software development including Windows Phone development, data access, cloud computing, testing, and user interface design.

Some of the main topics covered include Windows Phone 7 development, OData querying with jQuery, branch synchronization in SQL Azure, test effort measurement, sound recording in Windows Phone 7, and Visual Studio source control guidance.

The magazine discusses tools from Infragistics for collaboratively designing user interfaces using wireframes and controls as well as the <oXygen/> XML editor for XML authoring and conversion.

THE MICROSOFT JOURNAL FOR DEVELOPERS

COLUMNS
TOOLBOX
Windows Phone 7 Development
Tools and Resources
Terrence Dorsey page 6
CUTTING EDGE
Policy Injection in Unity
Dino Esposito page 10
DATA POINTS
Slice and Dice OData with the
jQuery DataTables Plug-In
Julie Lerman page 18
FORECAST: CLOUDY
Branch-Node Synchronization
with SQL Azure, Part 2:
Service-Based Sync
Joseph Fultz page 24
TEST RUN
Measuring Test Effort
Progress with EVM
James McCaffrey page 88
UI FRONTIERS
Super Simple Sound Recording
in Windows Phone 7
Charles Petzold page 91
DONT GET ME STARTED
Never, Never Land
David Platt page 96
FEBRUARY 2011 VOL 26 NO 2
DYNAMIC PROGRAMMING
Understanding the Dynamic Keyword in C# 4
Alexandra Rusina . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Known Types and the Generic Resolver
Juval Lowy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Pattern Matching Database Records with F#
Ambar Ray. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
PLUS:
Managing Employee Rewards with
Ofce and SharePoint BCS
Ying Xiong. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Its All About the SynchronizationContext
Steve Cleary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Visual Studio TFS Branching and Merging Guidance
Bill Heys and Willy-Peter Schaub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Securing WF 4 Workow Services
Zulqar Ahmed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Using Quince

, you and your team can


collaborate on the user interface using
wireframes, designs and examples.
Then use NetAdvantage UI controls,
like the map control used here, to bring
the application to life quickly & easily.
...
............................................................................................
.......................................................................
Untitled-7 2 11/10/10 10:59 AM
From start to nish, Infragistics gives you the tools to create
impressive user experiences that'll make end users happy!
SEE HOW WE USE THE TOOLS
TO CREATE THIS KILLER APP AT
INFRAGISTICS.COM/IMPRESS
Infragistics Sales 800 231 8588 Infragistics Europe Sales +44 (0) 800 298 9055 Infragistics India +91 80 4151 8042 @infragistics
..............................................................................................................................
...
Untitled-7 3 11/10/10 10:59 AM
magazine
Printed in the USA
FEBRUARY 2011 VOLUME 26 NUMBER 2
LUCINDA ROWLEY Director
DIEGO DAGUM Editorial Director/mmeditor@microsoft.com
KERI GRASSL Site Manager
KEITH WARD Editor in Chief/mmeditor@microsoft.com
TERRENCE DORSEY Technical Editor
DAVID RAMEL Features Editor
WENDY GONCHAR Managing Editor
KATRINA CARRASCO Associate Managing Editor
SCOTT SHULTZ Creative Director
JOSHUA GOULD Art Director
CONTRIBUTING EDITORS K. Scott Allen, Dino Esposito, Julie Lerman, Juval
Lowy, Dr. James McCaffrey, Ted Neward, Charles Petzold, David S. Platt
Henry Allain President, Redmond Media Group
Matt Morollo Vice President, Publishing
Doug Barney Vice President, Editorial Director
Michele Imgrund Director, Marketing
Tracy Cook Online Marketing Director
ADVERTISING SALES: 508-532-1418/mmorollo@1105media.com
Matt Morollo VP, Publishing
Chris Kourtoglou Regional Sales Manager
William Smith National Accounts Director
Danna Vedder Microsoft Account Manager
Jenny Hernandez-Asandas Director Print Production
Serena Barnes Production Coordinator/msdnadproduction@1105media.com
Neal Vitale President & Chief Executive Offcer
Richard Vitale Senior Vice President & Chief Financial Offcer
Michael J. Valenti Executive Vice President
Abraham M. Langer Senior Vice President, Audience Development & Digital Media
Christopher M. Coates Vice President, Finance & Administration
Erik A. Lindgren Vice President, Information Technology & Application Development
Carmel McDonagh Vice President, Attendee Marketing
David F. Myers Vice President, Event Operations
Jeffrey S. Klein Chairman of the Board
MSDN Magazine (ISSN 1528-4859) is published monthly by 1105 Media, Inc., 9201 Oakdale Avenue,
Ste. 101, Chatsworth, CA 91311. Periodicals postage paid at Chatsworth, CA 91311-9998, and at
additional mailing offces. Annual subscription rates payable in US funds are: U.S. $35.00, International
$60.00. Annual digital subscription rates payable in U.S. funds are: U.S. $25.00, International $25.00.
Single copies/back issues: U.S. $10, all others $12. Send orders with payment to: MSDN Magazine,
P.O. Box 3167, Carol Stream, IL 60132, email MSDNmag@1105service.com or call (847) 763-9560.
POSTMASTER: Send address changes to MSDN Magazine, P.O. Box 2166, Skokie, IL 60076. Canada
Publications Mail Agreement No: 40612608. Return Undeliverable Canadian Addresses to Circulation
Dept. or IMS/NJ. Attn: Returns, 310 Paterson Plank Road, Carlstadt, NJ 07072.
Printed in the U.S.A. Reproductions in whole or part prohibited except by written permission. Mail requests
to Permissions Editor, c/o MSDN Magazine, 16261 Laguna Canyon Road, Ste. 130, Irvine, CA 92618.
Legal Disclaimer: The information in this magazine has not undergone any formal testing by 1105 Media,
Inc. and is distributed without any warranty expressed or implied. Implementation or use of any information
contained herein is the readers sole responsibility. While the information has been reviewed for accuracy,
there is no guarantee that the same or similar results may be achieved in all environments. Technical
inaccuracies may result from printing errors and/or new developments in the industry.
Corporate Address: 1105 Media, Inc., 9201 Oakdale Ave., Ste 101, Chatsworth, CA 91311, www.1105media.com
Media Kits: Direct your Media Kit requests to Matt Morollo, VP Publishing, 508-532-1418 (phone),
508-875-6622 (fax), mmorollo@1105media.com
Reprints: For single article reprints (in minimum quantities of 250-500), e-prints, plaques and posters contact:
PARS International, Phone: 212-221-9595, E-mail: 1105reprints@parsintl.com, www.magreprints.com/
QuickQuote.asp
List Rental: This publications subscriber list, as well as other lists from 1105 Media, Inc., is available
for rental. For more information, please contact our list manager, Merit Direct. Phone: 914-368-1000;
E-mail: 1105media@meritdirect.com; Web: www.meritdirect.com/1105
All customer service inquiries should be sent to MSDNmag@1105service.com or call 847-763-9560.
programmersparadi se. com
Your best source for
software development tools!
Prices subject to change. Not responsible for typographical errors.

programmers.com/textcontrol
Download a demo today.
Professional Edition
Paradise #
T79 12101A01
$
1,109.
99
.NET WinForms and WPF rich
text box for VB.NET and C#
ActiveX for VB6, Delphi, VBScript/HTML, ASP
File formats DOCX, DOC, RTF, HTML,
XML, TXT
PDF and PDF/A export, PDF text import
Tables, headers & footers, text frames,
bullets, structured numbered lists, multiple
undo/redo, sections, merge fields, columns
Ready-to-use toolbars and dialog boxes
TX Text Control 16.0
Word Processing Components
TX Text Control is royalty-free, robust and
powerful word processing software
in reusable component form.
programmers.com/embarcadero
Embarcadero RAD Studio XE
by Embarcadero
Embarcadero RAD Studio XE is a comprehensive
application development suite and the fastest
way to visually build GUI-intensive, data-driven
applications for Windows, .NET, PHP and the Web.
RAD Studio includes Delphi

, C++Builder

, Delphi
Prism

, and RadPHP

; providing powerful com-


piled, managed and dynamic language support,
heterogeneous database connectivity, rich visual
component frameworks, and a vast 3rd party
ecosystem enabling you to deliver
applications up to 5x faster across multiple
Windows, Web, and database platforms.
Paradise #
CGI 15401A01
$
1,383.
99
programmers.com/vSphere programmers.com/LEAD
LEADTOOLS Document
Imaging SDK v17.0
by LEAD Technologies
LEADTOOLS Document Imaging has every compo-
nent you need to develop powerful image-enabled
business applications including specialized bi-tonal
image processing, document clean up, annota-
tions, high-speed scanning, advanced compression
(CCITT G3/G4, JBIG2, MRC, ABC), and
Win32/64 binaries for C/C++, .NET, Silverlight,
WPF, WCF, & WF. Available add-ons include:
Multi-threaded OCR/ICR/OMR/MICR/
Barcodes (1D/2D)
Forms Recognition/Processing
Print Capture and Document Writers
PDF, PDF/A and XPS
Paradise #
L05 03301A01
$
2,007.
99
VMware vSphere
Essentials Kit Bundle
vSphere Essentials provides an all-in-one
solution for small offices to virtualize three
physical servers for consolidating and
managing applications to reduce hardware
and operating costs with a low up-front
investment. vSphere Essentials includes:
VMware ESXi and VMware ESX
(deployment-time choice)
VMware vStorage VMFS
Four-way virtual SMP
VMware vCenter Server Agent
VMware vStorage APIs/VCB
VMware vCenter Update Manager
VMware vCenter Server for Essentials
for 3 hosts
Paradise #
V55 85101C02
$
446.
99
programmers.com/vmware
VMware Workstation 7
VMware Workstation 7 is the gold-standard
virtualization software for desktop and laptop
computers, with the richest feature set and
broadest platform support available. VMware
Workstation enables users to create and host
multiple virtual machines on a single desktop,
expanding the power of desktop systems for
IT administrators; software development and
test engineers; technical sales, training and
support staff; and PC enthusiasts.
VMware Workstation transforms the way
technical professionals develop, test, demo,
and deploy software. Workstations innovative
features for VMware environments help to
reduce hardware cost, save time, minimize
risk, and streamline tasks that save time
and improve productivity.
for Linux &
Windows
Paradise #
V55 22301A04
$
149.
99
ActiveReports 6
by GrapeCity
The de facto standard reporting tool
for Microsoft Visual Studio.NET
Fast and Flexible reporting engine
Flexible event-driven API to completely
control the rendering of reports
Wide range of Export and Preview formats
including Windows Forms Viewer, Web
Viewer, Adobe Flash and PDF
XCopy deployment
Royalty-Free Licensing for Web and
Windows applications
Professional Ed.
Paradise #
D03 04301A01
$
1,310.
99
NEW
VERSION
6!
programmers.com/grapecity
866- 719- 1528
programmers.com/microsoft
Microsoft Visual Studio
Professional 2010 Upgrade
by Microsoft
Upgrade to Microsoft Visual Studio 2010
Professional the integrated environment that
simplifies creating, debugging and deploying
applications. Unleash your creativity and bring
your vision to life with powerful design surfaces
and innovative collaboration methods for devel-
opers and designers. Work within a personalized
environment, targeting a growing number of
platforms, including Microsoft SharePoint and
cloud applications and accelerate the coding
process by using your existing skills. Integrated
support for Test-First Development and new
debugging tools let you find and fix bugs quickly
and easily to ensure high quality solutions.
with MSDN
Single user
Paradise #
M47 40201B02
$
488.
99
New Intel Visual
Fortran Compiler
by Intel
Intel

Visual Fortran Composer XE


2011 includes the latest generation of Intel

Fortran compilers, Intel

Visual Fortran Compiler


XE 12.0 for Windows. Intel

Fortran Composer
XE is available for Linux and Mac OS X. This
package delivers advanced capabilities for
development of application parallelism and
winning performance for the full range of Intel

processor-based platforms and other compatible


platforms. It includes the compilers breadth of
advanced optimization, multithreading, and
processor support, as well as automatic proces-
sor dispatch, vectorization, and loop unrolling.
for Windows
Single (SSR)
Paradise #
I23 86101E03
$
263.
99
programmers.com/intel programmers.com/microsoft
Microsoft SQL Server
Developer Edition 2008 R2
by Microsoft
SQL Server 2008 Developer enables
developers to build and test applications
that run on SQL Server on 32-bit, ia64, and
x64 platforms. SQL Server 2008 Developer
includes all of the functionality of Enterprise
Edition, but is licensed only for development,
test, and demo use. The license for SQL
Server 2008 Developer entitles one developer
to use the software on as many systems
as necessary. For rapid deployment into
production, instances of SQL Server 2008
Developer can easily be upgraded to SQL
Server 2008 Enterprise without reinstallation.
2-bit/x64
IA64 DVD
Paradise #
M47 31101A04
$
41.
99
NEW
RELEASE!
programmers.com/sparxsystems
Enterprise Architect
Corporate Edition
Visualize, Document and
Control Your Software Project
by Sparx Systems
Enterprise Architect is a comprehensive,
integrated UML 2.1 modeling suite
providing key benefits at each stage of
system development. Enterprise Architect
7.5 supports UML, SysML, BPMN and
other open standards to analyze, design,
test and construct reliable, well under-
stood systems. Additional plug-ins are
also available for Zachman Framework,
MODAF, DoDAF and TOGAF, and to
integrate with Eclipse and Visual Studio
2005/2008.
1-4 Licenses
Paradise #
SP6 03101A02
$
182.
99
programmers.com/idm
IDM UltraEdit
The #1 Best Selling Text Editor
in the World
by IDM
UltraEdit is the worlds standard in text
editors. Millions use UltraEdit as the
ideal text/hex/programmers editor
on any platform Windows, Linux,
or Mac!
Features include syntax highlighting
for nearly any programming language;
powerful Find, Replace, Find in Files,
and Replace in Files; FTP support, sort,
column mode, hex, macros/scripting,
large file handling (4+ GB), projects,
templates, Unicode, and more.
Named User
1-24 Users
Paradise #
I84 01201A01
$
59.
95
NEW
RELEASE!
Win an iPad!
Place an Order for Software
(or Hardware) with
Programmers Paradise
and Youll be Entered
for a Drawing to Win
an iPad Wi-Fi 32GB.
Just Use the Offer Code TRWD02
When You Place Your Order Online or with
Your Programmers Paradise Representative.
New
Version
Released!
Untitled-1 1 1/7/11 11:09 AM
msdn magazine 4
article on Windows Workfow Foundation will get a thumbs-down
from yours truly. Id like to write an article on authoring
custom control fow activities in WF 4, on the other hand, is much
more likely to get a thumbs-up. In fact, it did for Leon Welicki, who
wrote that exact article for the last issue.
Keep in mind that our readers are generally high-level pros who
want specifc answers to specifc development problems or chal-
lenges. To that end, present practical advice for solving real-world
issues. I dont need articles on what the OData Protocol is or can
be used for: instead, pitch me an idea on integrating OData with
existing Atom- and AtomPub-based readers and writers, as Chris
Sells did in the August 2010 issue.
Another source of great anxiety for would-be writers is writing
experience. Tey wonder if they have a chance if theyve published
nothing but a few blog entries here and there. If thats you, have no
fear: previous writing experience is not a prerequisite. Im more
interested in the article idea and how youd execute it than in how
much writing youve done.
Certainly it doesnt hurt if youve written before, but if you can
demonstrate basic writing competency in your communications
the initial proposal, as well as additional correspondencewell
consider hiring you.
If youre an inexperienced writer, know from the outset that
writing is dif cult, and writing these types of articles is an art unto
itself. Its one thing to know how to build sofware, and another
thing entirely to write about building sofware.
And youre not done even then. Te editing process that follows
the writingwhere we work with you to polish, fne-tune or even
ask you to make major revisions to your workcan be agonizing.
I dont say this to scare you of, but to give a realistic glimpse of
what lies ahead. If you truly want to do this, what Im saying wont
scare you anyway, and youre likely to come out with a successful
article and see your name in the pages of MSDN Magazine.
Send article ideas to me at
mmeditor@microsof.com.
Quick Guide to Getting Published
If theres one question I get asked more than any other at confer-
ences, its this: Hey, I have a great idea for an MSDN Magazine
article. How do I get it published?
Its a good question. Afer all, writing a magazine article isnt like
writing code; forgetting the semicolon I just placed (afer code)
is less serious than forgetting a semicolon in C#. In one important
way, however, they are similartheyre both creative endeavors in
which you start with a blank page or empty Visual Studio project
window. From that void comes, hopefully, something wonderful.
Here are the most important things to do.
1. Bribes never hurt. Remember the rule of thumb: Te more
zeros in the check, the more likely the acceptance of your article.
All proceeds go to support needy childrenmine.
OK. Enough with the comedy portion of our show. Please dont
send me cash.
Te frst thing you do need, however, is a great idea for an article.
You could have Bill Gates programming savvy and Hemingways
writing chops, but if your ideas as lame as the new crop of reality
TV shows, it doesnt matter.
So whats a great idea, you properly ask? Tats hard to quantify,
but I can list some general guidelines. First, as any editor will tell
you, read back issues. If youre a regular MSDN Magazine reader
and pore over every issue, youll likely have an intuitive sense of
the kind of articles we publish. If not, get your hands on the last
half-dozen issues or so (remember that theyre published online
in their entirety as well) and do some research.
Such research will quickly reveal some important facts. No. 1,
this is a very technical magazine written mostly for experienced
developers. Introductory and overview type articles dont make it
in, for the most part. Tese are not 100-level stories, so keep that in
the front of your mind. Tere are plenty of places to publish those
types of articles, and theyre of great value to the right audience.
Just know that its not our audience.
Fact No. 2: Articles of a general nature are shunned. Another
rule of thumb: General = Bad. Specifc = Good. Id like to write an
EDITORS NOTE KEITH WARD
2011 Microsoft Corporation. All rights reserved.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, you are not permitted to reproduce, store, or introduce into a retrieval system MSDN Magazine or any part of MSDN
Magazine. If you have purchased or have otherwise properly acquired a copy of MSDN Magazine in paper format, you are permitted to physically transfer this paper copy in unmodifed form. Otherwise, you are not permitted to transmit
copies of MSDN Magazine (or any part of MSDN Magazine) in any form or by any means without the express written permission of Microsoft Corporation.
A listing of Microsoft Corporation trademarks can be found at microsoft.com/library/toolbar/3.0/trademarks/en-us.mspx. Other trademarks or trade names mentioned herein are the property of their respective owners.
MSDN Magazine is published by 1105 Media, Inc. 1105 Media, Inc. is an independent company not affliated with Microsoft Corporation. Microsoft Corporation is solely responsible for the editorial contents of this magazine. The
recommendations and technical guidelines in MSDN Magazine are based on specifc environments and confgurations. These recommendations or guidelines may not apply to dissimilar confgurations. Microsoft Corporation does not make
any representation or warranty, express or implied, with respect to any code or other information herein and disclaims any liability whatsoever for any use of such code or other information. MSDN Magazine, MSDN, and Microsoft logos are
used by 1105 Media, Inc. under license from owner.
Visit us at msdn.microsoft.com/magazine. Questions, comments or suggestions for MSDN Magazine? Send them to the editor: mmeditor@microsoft.com.
Untitled-2 1 12/13/10 4:28 PM
msdn magazine 6
App Hub
Next, head over to the Microsoft App Hub
(create.msdn.com) and set up your account.
App Hub is a community for developers
of apps and games for Windows Phone 7
or games for Xbox 360. You can nd tools,
advice and the support of fellow app
developers here. Plus, youll use the App
Hub dashboard as the ofcial tool for
submitting your apps for the Windows
Phone marketplace.
To register for App Hub youll need a
Windows Live ID, and theres a yearly $99
fee for membership.
Visual Basic Development
The rst tools for Windows Phone devel-
opment focused on C# as the coding
language. But if you prefer Visual Basic,
dont fret. The Visual Studio team has
released Visual Basic for Windows Phone
Developer Tools (bit.ly/haiyqH), which
allows you to dive right in.
The team announcement even
includes a tutorial for creating your rst
Visual Basic app for Windows Phone 7,
walking you through the development of
a simple tip-calculator app. No excuses
nowget coding!
Windows Phone 7 for
Absolute Beginners
Still not sure what to do next? Get
yourself over to Channel 9 and check
out the Windows Phone 7 Development
for Absolute Beginners video series
(bit.ly/fZJSqC). Clint Rutkus and Bob Tabor
(from LearnVisualStudio.net) guide you
through this series of 65 short videos covering everything from plat-
form basics to debugging and error handling. Youll even dive into
details such as using the GPS capabilities of Windows Phone 7 devices.
XPF: A Layout Framework for XNA
General UI design and composition on Windows Phone 7 utilizes
Windows Presentation Foundation (WPF) and Silverlight. But if youre
building games for the phone platform, youre most likely going to
Windows Phone 7 Development
Tools and Resources
Without a doubt, one of the hottest
areas for development these days is
mobile apps. The smartphone market is
expected to grow by 55 percent in the
next year alone.
Last year, Microsoft dove back into
the mobile device fray with the Windows
Phone 7 platform. For the consumer,
Windows Phone 7 offers a modern multi-
touch interface, integration with e-mail,
Facebook and Zune services, and the
ability to install apps to have fun or get
work done. For the developer, Windows
Phone 7 provides a straightforward
programming target based on Silverlight
and the Microsoft .NET Framework, along
with the ability to reach a largeand
growingaudience of customers.
Sounds like a no-brainer, right?
Weve already shown you a few useful
tips for Windows Phone 7 programming
in the pages of MSDN Magazine, but
heres a concise guide to some of the
tools and information youll need to get
started and create useful, polished apps.
At the sound of the tone, its time to
get coding ...
Windows Phone
Developer Tools
The basic tools youll need to start writing
code for Windows Phone 7 are Visual
Studio 2010 and Windows Phone Devel-
oper Tools (microsoft.com/express/Phone).
The developer tools include Visual
Studio 2010 Express for Windows Phone,
the Windows Phone Emulator, Silverlight
for Windows Phone, XNA Game Studio
4.0 and Expression Blend 4 for Windows Phone. If you already have
Visual Studio 2010, XNA Game Studio or Expression Blend 4 installed,
the developer tools will just update the applications with templates
and other elements you need for Windows Phone development.
Once you have the tools installed, start browsing through the
MSDN Windows Phone Development documentation (bit.ly/fSYt8d).
This is a crucial resource that youll come back to again and again.
Add it to your favorites today.
Figure 2 Windows Phone 7 for
Absolute Beginners
Figure 1 App Hub
TOOLBOX TERRENCE DORSEY
Untitled-5 1 12/14/10 11:45 AM
msdn magazine 8 Toolbox
TOOLBOX
be using XNA Game Studio (msdn.microsoft.com/aa937791), which uses
a different layout architecture.
To simplify design under XNA, Red Badger has created XPF
(bit.ly/dMAIOA), a layout framework for creating Windows and Windows
Phone 7 apps with XNA. The XPF framework runs in a pure XNA applic-
ation, yet was written to be familiar to WPF and Silverlight developers.
There are 11 built-in controls, along with support for dependency
properties, attached properties, animation and data binding. Plus,
XPF is extensible to accommodate your own custom controls.
Its also worth taking a look through the Red Badger blog for
additional tips and tricks for building and testing your Windows
Phone 7 applications (red-badger.com/Blog/?tag=/wp7).
Free Charles Petzold eBook
Our own Charles Petzold (bit.ly/enl2dg), along
with the Windows Phone 7 team, wrote the
aptly titled Programming Windows Phone
7 (bit.ly/foFbvZ). As youd expect from the guy
who wrote ve editions of the seminal
Programming Windows (Microsoft Press,
1998), this tome is extensive and denitive.
The best part? Its free. Download the book
in PDF format along with all of the sample
code. For ongoing discussion of the book
and Windows Phone 7 development issues,
read Petzolds blog as well (charlespetzold.com/blog/blog.xml).
And next time someone asks you a Windows Phone programming
question, you can still tell them: Look it up in Petzold.
31 Days of Windows Phone 7
In the same vein as the Channel 9 videos mentioned earlier, Microsoft
developer evangelist Jeff Blankenburg blogged 31 Days of Windows
Phone 7 (bit.ly/dJ0u8k), writing a post every day in October 2010 that
covers a different aspect of coding for Windows Phone 7. Blankenburg
starts with the basic project template and works through topics includ-
ing storage, UI controls, debugging, and even submitting your app to
the Windows Phone Marketplace and integrating ads into your app.
Blankenburgs blog is full of other Silverlight and Windows Phone
7 development tips, and the 31 Days posts have been translated into
Russian and Spanish.
Helpful Client Frameworks
Frameworks can really take a lot of the hassle out of building infra-
structure or adding specic functionality to your application. Two of
the more popular client frameworks for Windows Phone 7 on
CodePlex are Caliburn Micro and nRoute.
Caliburn Micro (caliburnmicro.codeplex.com) is a small-yet-powerful
implementation of the Caliburn (caliburn.codeplex.com) framework for
Silverlight, Windows Phone 7 and WPF. These frameworks are
design ed to help you build application UIs quickly and easily using
the Model-View-Controller (MVC), Model-View-Presenter (MVP),
Model-View-ViewModel (MVVM) and Application Controller patterns.
Caliburn Micro has an active community providing information,
support and examples. Get started by checking out the
Caliburn.Micro Soup to Nuts series of posts on devlicio.us (bit.ly/hLT7lL)
to follow the creation of a simple Silverlight application, starting with
the basics of getting Caliburn Micro from the repository.
nRoute (nroute.codeplex.com) is another client framework for Silverlight,
Windows Phone 7 and WPF that lets you build apps using the
MVVM pattern. John Thiriet has an extensive series of blog posts
(blog.john-thiriet.com/en/) showing you how to use nRoutein both
French and Englishand the orktane blog has a great tutorial on
using nRoute to create a game (bit.ly/fwF9pL).
More Tips and Tricks
One of the great side effects of the Windows Phone 7 platform has
been the outpouring of shared information from members of the
development community.
Youll nd everything from getting-started guides to tips for
handling specic development tasks, and even ways to run other
languages on the phone. Heres what we think are some of the best
posts out there:
MobiForge
Introduction to Windows Phone 7 Development Series
bit.ly/gmygUR
IE for Windows Phone Team Weblog
Targeting Mobile-Optimized CSS at Windows Phone 7
bit.ly/h5ZJwY
Ivo Manolov
Registering Your WP7 as a Developer Device
bit.ly/exSPzi
Kevin Marshall
WP7 Development Tips Part 1
bit.ly/fTcljh
Mike Ormond
Windows Phone 7 Screen Capture
bit.ly/hSraKE
MSDN Magazine
IronRuby on Windows Phone
bit.ly/gA5x7J
TERRENCE DORSEY is the technical editor of MSDN Magazine. You can read his
blog at terrencedorsey.com or follow him on Twitter: @tpdorsey.
THANKS to the following technical experts for reviewing this article:
Luke Nyswonger, Joshua Partlow, Brendan Mitchell, Orville McDonald
Programming
Windows Phone 7
eBook
One of the great side effects of
the Windows Phone 7 platform
has been the outpouring of
shared information
from members of the
development community.
Untitled-5 1 12/14/10 11:46 AM
msdn magazine 10
method call, or both. You can attach a behavior to a type using
fuent code as well as a confguration script. In this way, all you do
is defne a join point. But what about pointcuts?
As we saw last month, all intercepted methods on the target
object will execute according to the logic expressed in the Invoke
method of the behavior object. Te basic interception API doesnt
provide you with the ability to distinguish between methods and
doesnt support specifc matching rules. To get this, you may resort
to the policy injection API.
Policy Injection and PIAB
If youve used versions of the Microsof Enterprise Library (EntLib)
prior to the latest version, 5.0, you may have heard about Policy
Injection Application Block (PIAB), and chances are that you also
took advantage of it in some of your applications. EntLib 5.0 also
features a PIAB module. So whats the diference between the Unity
policy injection and EntLib PIAB?
In EntLib 5.0, PIAB exists mostly for compatibility reasons. Te
content of the PIAB assembly changed in the new version. In
particular, all the machinery for interception is now part of Unity
and all system-provided call handlers in earlier versions of EntLib
were moved to other assemblies, as shown in Figure 1.
As you can see in Figure 1, each call handler was moved to the
assembly of the associated application block. So the exception-handling
call handler moved to the exception-handling application block and
the validation handler moved to the validation-application block and
so on. Te only exception to this rule was the performance-counter
handler, which moved to the PolicyInjection assembly. Although
the assemblies changed, the namespace of the classes remained
just the same. Its also worth noting that, due to security concerns,
the caching call handler previously included in PIAB was removed
from EntLib 5.0 and made available only through the EntLib
Contrib CodePlex Web site at bit.ly/gIcP6H. The net effect of these
changes is that PIAB is now made of legacy components available
just for backward compatibility that still require some code changes
Policy Injection in Unity
In the past two articles, I presented aspect-oriented programming
(AOP) using Microsof Unity 2.0. Formalized in the 1990s as a way
to further improve and complement object-oriented programming
(OOP), AOP was recently revamped, and many Inversion of Control
(IoC) libraries support it. Unity is no exception. Te main purpose
of AOP is to let developers more efectively deal with crosscutting
concerns. In essence, AOP addresses the following question:
When you design an object model for an application, how do you
deal with aspects of the code such as security, caching or logging?
Tese aspects are key to implementation, but dont strictly belong
to the objects in the model youre building. Should you spoil your
design to incorporate non-business aspects? Or are you better of
decorating your business-oriented classes with additional aspects?
If you choose the latter, AOP basically provides a syntax to defne
and attach these aspects.
An aspect is the implementation of a crosscutting concern. In the
defnition of an aspect, you need to specify a few things. First, you
need to provide the code for the concern you implement. In AOP
jargon, this is known as the advice. An advice is applied to a specifc
point of codewhether the body of a method, the getter/setter of
a property or perhaps an exception handler. Tis is known as the
join point. Finally, in AOP jargon, you fnd pointcuts. A pointcut
represents a collection of join points. Usually, pointcuts are defned
by criteria using method names and wildcards. AOP ultimately
acts in the runtime to inject the code of the advice before, afer and
around the join point. An advice then is associated with a pointcut.
In the previous articles, I explored the interception API of Unity.
Te API lets you defne advices to attach to classes. In Unity jargon,
the advice is a behavior object. You typically attach the behavior
to a type thats resolved via the IoC mechanism of
Unity, even though the interception mechanism
doesnt strictly require the IoC functionality. In
fact, you can confgure interception to apply also to
instances created via plain code.
A behavior consists in a class that implements a
fxed interfacethe IInterceptionBehavior interface.
Te interface features a method named Invoke. By
overriding this method, you actually defne the steps
you want to be executed before or afer the regular
CUTTING EDGE DINO ESPOSITO
Call Handler New Assembly in Enterprise Library 5.0
Authorization handler Microsoft.Practices.EnterpriseLibrary.Security.dll
Caching-handling handler Removed from PIAB
Exception-handling handler Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Logging handler Microsoft.Practices.EnterpriseLibrary.Logging.dll
Performance-counter handler Microsoft.Practices.EnterpriseLibrary.PolicyInjection.dll
Validation handler Microsoft.Practices.EnterpriseLibrary.Validation.dll
Figure 1 Refactoring of Call Handlers in the Microsoft Enterprise Library 5.0
An aspect is the implementation
of a crosscutting concern.
Untitled-5 1 12/14/10 11:44 AM
msdn magazine 12 Cutting Edge
to compile with version 5.0. Unless you have serious legacy depen-
dencies, the recommended approach is that you upgrade your policy
injection layers to take advantage of the new (and largely similar)
policy injection API baked into the Unity application block. Lets
fnd out more about policy injection in Unity.
Policy Injection at a Glance
Policy injection is a layer of code that extends the basic Unity inter-
ception API to add mapping rules and call handlers on a per-method
basis. Implemented as a special interception behavior, policy injec-
tion consists of two main phases: initialization and execution time.
During the initialization phase, the framework frst determines
which of the available policies can be applied to the target method
being intercepted. In this context, a policy is described as a set of
operations that can be injected in a particular order between the
object being intercepted and its actual caller. You can only inter-
cept methods on objects (either existing instances or newly created
instances) that have been explicitly confgured for policy injection.
Having fgured out the list of applicable
policies, the policy injection framework pre-
pares the pipeline of operations (an operation
is referred to as a call handler). Te pipeline
results from the combination of all the han-
dlers defned for each of the matching policies.
Te handlers in the pipeline are sorted based
on the order of the policy and the priority
assigned to each handler in the parent policy.
When a policy-enabled method is invoked,
the previously built pipeline is processed. If the
method, in turn, places calls to other policy-
enabled methods on the same object, the
handler pipelines of those methods are merged into the main pipeline.
Call Handlers
A call handler is more specific than a behavior and really looks
like an advice, as it was originally defined in AOP. Whereas a
behavior applies to a type and leaves to you the burden of taking
diferent actions for diferent methods, a call handler is specifed
on a per-method basis.
Call handlers are composed in a pipeline and invoked in a pre-
determined order. Every handler is able to access details of the call,
including method name, parameters, return values and expected return
type. A call handler can also modify parameters and return values, stop
the propagation of the call down the pipeline and raise an exception.
Its interesting to note that Unity doesnt come with any call han-
dlers. You can only create your own, or reference application blocks
from EntLib 5.0 and use any of the call handlers listed in Figure 1.
A call handler is a class that implements the ICallHandler inter-
face, like this:
public interface ICallHandler
{
IMethodReturn Invoke(
IMethodInvocation input,
GetNextHandlerDelegate getNext);
int Order { get; set; }
}
Te Order property indicates the priority of this handler related
to all others. Te Invoke method returns an instance of a class that
contains any return value from the method.
Te implementation of a call handler is quite simple in the sense
that its just expected to do its own specifc things and then let the
pipeline go. To yield control to the next handler in the pipeline,
the handler calls the getNext parameter it receives from the Unity
runtime. Te getNext parameter is a delegate defned as:
public delegate InvokeHandlerDelegate GetNextHandlerDelegate();
In turn, the InvokeHandlerDelegate is defned as:
public delegate IMethodReturn InvokeHandlerDelegate(
IMethodInvocation input,
GetNextHandlerDelegate getNext);
Te Unity documentation provides a clear diagram that illustrates
interception. In Figure 2, you see a slightly modifed diagram that
presents the architecture of policy injection.
Within the boundaries of a system-provided policy injection
behavior, you see the chain of handlers to process a given method
invoked on a proxy object or derived class. To complete the overview
of policy injection in Unity, we need to take a look at matching rules.
Matching Rule Description
AssemblyMatchingRule Selects target objects based on types in
the specied assembly.
CustomAttributeMatchingRule Selects target objects based on a
custom attribute at the member level.
MemberNameMatchingRule Selects target objects based on
member name.
MethodSignatureMatchingRule Selects target objects based on
the signature.
NamespaceMatchingRule Selects target objects based on
the namespace.
ParameterTypeMatchingRule Selects target objects based on the type
name of a parameter for a member.
PropertyMatchingRule Selects target objects based on member
names, including wildcard characters.
ReturnTypeMatchingRule Selects target objects based on the
return type.
TagMatchingRule Selects target objects based on the
value assigned to an ad hoc
Tag attribute.
TypeMatchingRule Selects target objects based on the
type name.
Figure 3 List of Supported Matching Rules in Unity 2.0
Figure 2 The Call Handler Pipeline in the Unity Policy Injection
Unity Interception Pipeline
Return
Value
Invoke
Method
Input
Return
Value
Input
Return
Value
Client Application
Target Object
Unity Interceptor
Handler Handler Handler Han Handle dlerr Han Handle dlerr Han Handle dlerr
Policy Injection Behavior
Untitled-5 1 12/14/10 11:45 AM
msdn magazine 14 Cutting Edge
Matching Rules
Trough a matching rule, you specify where to apply your inter-
ception logic. If you use behaviors, your code applies to the entire
object; with one or more matching rules, you can defne a flter. A
matching rule indicates a criterion to select objects and members to
which Unity will attach a handler pipeline. Using AOP terminology,
a matching rule is the criterion that you use to defne the pointcuts.
Figure 3 lists the matching rules natively supported by Unity.
A matching rule is a class that implements the IMatchingRule inter-
face. Armed with this knowledge, lets see how to work with policy
injection. Tere are essentially three ways in which you can defne
policies: using attributes, using fuent code and via confguration.
Adding Policies via Attributes
Figure 4 shows an example call handler that throws an exception
if the result of an operation is negative. Ill be using this same handler
in various scenarios.
The simplest way to use the handler is by attaching it to any
method where you think it can be useful. For this, you need an
attribute, such as:
public class NonNegativeCallHandlerAttribute : HandlerAttribute
{
public override ICallHandler CreateHandler(
IUnityContainer container)
{
return new NonNegativeCallHandler();
}
}
Heres a sample Calculator class that you decorate with attribute-
based policies:
public class Calculator : ICalculator
{
public Int32 Sum(Int32 x, Int32 y)
{
return x + y;
}
[NonNegativeCallHandler]
public Int32 Sub(Int32 x, Int32 y)
{
return x - y;
}
}
Te result is that calls to method Sum proceed as usual regardless
public static UnityContainer Initialize()
{
// Creating the container
var container = new UnityContainer();
container.AddNewExtension<Interception>();
// Adding type mappings
container.RegisterType<ICalculator, Calculator>(
new InterceptionBehavior<PolicyInjectionBehavior>(),
new Interceptor<TransparentProxyInterceptor>());
// Policy injection
container.Configure<Interception>()
.AddPolicy("non-negative")
.AddMatchingRule<TypeMatchingRule>(
new InjectionConstructor(
new InjectionParameter(typeof(ICalculator))))
.AddMatchingRule<MemberNameMatchingRule>(
new InjectionConstructor(
new InjectionParameter(new[] {"Sub", "Test"})))
.AddMatchingRule<ReturnTypeMatchingRule>(
new InjectionConstructor(
new InjectionParameter(typeof(Int32))))
.AddCallHandler<NonNegativeCallHandler>(
new ContainerControlledLifetimeManager(),
new InjectionConstructor());
return container;
}
Figure 5 Fluent Code to Dene a Set of Matching Rules
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<assembly name="PolicyInjectionConfig"/>
<namespace name="PolicyInjectionConfig.Calc"/>
<namespace name="PolicyInjectionConfig.Handlers"/>
<sectionExtension ... />
<container>
<extension type="Interception" />
<register type="ICalculator" mapTo="Calculator">
<interceptor type="TransparentProxyInterceptor" />
<interceptionBehavior type="PolicyInjectionBehavior" />
</register>
<interception>
<policy name="non-negative">
<matchingRule name="rule1"
type="TypeMatchingRule">
<constructor>
<param name="typeName" value="ICalculator" />
</constructor>
</matchingRule>
<matchingRule name="rule2"
type="MemberNameMatchingRule">
<constructor>
<param name="namesToMatch">
<array type="string[]">
<value value="Sub" />
</array>
</param>
</constructor>
</matchingRule>
<callHandler name="handler1"
type="NonNegativeCallHandler">
<lifetime type="singleton" />
</callHandler>
</policy>
</interception>

</container>
</unity>
Figure 6 Preparing Policy Injection in the Conguration File
public class NonNegativeCallHandler : ICallHandler
{
public IMethodReturn Invoke(IMethodInvocation input,
GetNextHandlerDelegate getNext)
{
// Perform the operation
var methodReturn = getNext().Invoke(input, getNext);
// Method failed, go ahead
if (methodReturn.Exception != null)
return methodReturn;
// If the result is negative, then throw an exception
var result = (Int32) methodReturn.ReturnValue;
if (result <0)
{
var exception = new ArgumentException("...");
var response = input.CreateExceptionMethodReturn(exception);
// Return exception instead of original return value
return response;
}
return methodReturn;
}
public int Order { get; set; }
}
Figure 4 The NonNegativeCallHandler Class
msdnmagazine.com
of the returned value, whereas calls to method Sub will throw an
exception if a negative number is returned.
Using Fluent Code
If you dont like attributes, you can express the same logic via a
fuent API. In this case, you must provide many more details as far
as matching rules are concerned. Lets see how to express the idea
that we want to inject code only in methods that return an Int32
and are named Sub. You use the fuent API to confgure the Unity
container (see Figure 5).
Note that if you use the ContainerControlledLifetimeManager
manager, youre guaranteed that the same call handler instance is
shared by all of the methods.
Te efect of the code is that any concrete type that implements
ICalculator (that is, is confgured to be intercepted and is resolved
through Unity) will select two potential candidates for injection:
methods Sub and Test. However, only methods with an Int32 return
type will survive the further matching rule. This means that, for
example, Test will be ruled out if it happens to return a Double value.
Adding Policies Through Conguration
Finally, the same concept can be expressed using the confguration
fle. Figure 6 shows the expected content of the <unity> section.
As it turns out, when you have multiple matching rules in a
single policy, the fnal result is the Boolean operator AND applies
to all of them (meaning all of them must be true). If youve defned
multiple policies, then each one is evaluated for matchingand
handlers appliedindependently. Terefore, you can get handlers
applied from diferent policies.
Interception at a Glance
To recap, interception is the way in which most IoC frameworks
in the Microsof .NET Framework space implement aspect orien-
tation. Trough interception, youre given the chance of running
your own code before or afer any given method in any given type
in any given assembly. EntLib in the past provided a specifc appli-
cation block, PIAB, for achieving this. In EntLib 5.0, the underly-
ing engine of PIAB has been moved into Unity and implemented
as a special behavior for the Unity low-level interception API
that I covered in my previous two columns. Te policy injection
behavior requires the use of a Unity container and wont work only
through the low-level interception API.
Te low-level interception API, however, doesnt let you select
the type members you want to intercept; you have to write the code
to do that yourself. With the policy injection behavior, though, you
can concentrate on the details of the behavior you want, and let the
library take care of fguring out which methods it applies to based
on the rules you give it.
DINO ESPOSITO is the author of Programming Microsoft ASP.NET MVC
(Microsof Press, 2010) and coauthor of Microsof .NET: Architecting Applications
for the Enterprise (Microsof Press, 2008). Based in Italy, Esposito is a frequent
speaker at industry events worldwide. You can join his blog at weblogs.asp.net/despos.
THANKS to the following technical expert for reviewing this article:
Chris Tavares
Untitled-6 2 12/14/10 11:43 AM
Untitled-6 3 12/14/10 11:43 AM
msdn magazine 18
service (http://odata.netflix.com/v1/
Catalog), which gives me an opportunity
to show you how to deal with some com-
mon pitfalls you may encounter when
using various OData services.
You can download the DataTables
plug-in from datatables.net. If youre new
to consuming OData, you might want to
get up to speed by visiting the WCF Data
Services section of the MSDN Developer
Center at msdn.microsoft.com/data/odata.
Query OData with LINQ
and the Client APIs
Ill begin with a simple MVC application
where Ive added a service reference
to http://odata.netflix.com/v1/Catalog
using the Visual Studio Add Service Ref-
erence wizard. Tis, in turn, creates proxy
classes for me to consume in my appli-
cation and builds an Entity Data Model
based on the service, as shown in Figure
1. Te wizard also adds references to the
.NET Framework OData client library
APIs. Both the .NET Framework and
Silverlight OData client libraries make working with OData fairly
simple thanks to their support of LINQ querying.
My startup controller, HomeController.cs, uses the OData
client library and the service proxy to query for all of the movie
titles in a particular genre: Independent. Te results of the
query are returned to the View associated with this particular
controller action:
public ActionResult Index() {
var svcUri = new Uri("http://odata.netflix.com//v1//Catalog");
var context = new NetflixOData.NetflixCatalog(svcUri);
var query = from genre in context.Genres
where genre.Name == "Independent"
from title in genre.Titles
where title.ReleaseYear>=2007
select title ;
var titles = query.ToList();
return View(titles);
}
Slice and Dice OData with the jQuery
DataTables Plug-In
Te Open Data Protocol (OData) allows
data producers to provide their data
over the Web in a common format that
can be consumed by anyone using
an HTTP-enabled technology. Data is
provided through URIs and you can use
the common HTTP verbsGET, PUT,
POST, MERGE and DELETEto inter-
act with the data. You can handle this
interaction directly through a language
like JavaScript or by using a client API
such as the Microsof .NET Framework,
Silverlight, PHP or others provided by
Microsof. Either way, you can interact
with all OData feeds in the same way.
Tere are a growing number of publicly
provided OData services such as com-
mercial feeds from Netfix Inc. and eBay
Inc., World Cup data, even a service that
supplies 150 years of baseball statistics.
Accessing data is getting easier and
easier, but what about presenting the
data? When you have 150 years worth
of baseball stats or thousands of movie
titles, theres still some efort on the client
side to retrieve and navigate through all of that data.
At a recent Vermont .NET User Group presentation on jQuery,
I was inspired by a jQuery plug-in called DataTables as a low-
investment way to allow users to slice and dice large amounts of
data. The power of DataTables is in its blazingly fast client-side
processing, although it does allow you to be more interactive with
server-side code if you desire.
JQuery is a client-side Web technology (and can be used in any
type of Web application) that simplifes working with JavaScript. If
youve talked to anyone whos jumped on the jQuery bandwagon,
youll fnd a lot of passion for the technology. DataTables is one of a
huge number of jQuery plug-ins. And you can use jQuery in any type
of Web application.
As I happen to do most of my work with the .NET Framework,
in this column Ill demonstrate using some of the basic Data-
Tables plug-in features in applications using both ASP.NET MVC
and WebForms. However, the logic in the WebForms app will be
driven by client-side code. Ill be working with the Netfix OData
DATA POINTS JULIE LERMAN
Figure 1 The MVC Project in Solution Explorer
Code download available at code.msdn.microsoft.com/mag201102DataPoints.
s0OWERFUL3ILVERLIGHTCONTROLS
s#OMPLETESETOF!30.%4-6#COMPONENTS
s#UTTINGEDGE"USINESS)NTELLIGENCECOMPONENTS
Essential Studio Enterprise Edition:
1-888-9DOTNET | www.syncfusion.com
Untitled-4 1 12/9/10 3:21 PM
msdn magazine 20 Data Points
Te markup in the HomeController Index view (\Views\Home-
Controller\index.aspx) is where all of the interesting presentation
logic is being performed. To leverage jQuery and the DataTables
plug-in, youll need to add a set of script fles to your project. Alter-
natively, you can point to the online set of scripts (see the Microsof
AJAX Content Delivery Network at asp.net/ajaxLibrary/CDN.ashx), but Ive
chosen to host them locally. Te download for the DataTables plug-in
contains a \media folder (which contains the scripts) that you can
drop into your project. You can see Ive already done this in Figure 1.
Figure 2 contains the code listing of the Index.aspx fle.
Te CSS link and two script sources at the beginning of the
<head> section point to CSS formatting and the critical jQuery
and jQuery.datatables JavaScript fles.
Next, lets focus on the table as its laid out in the page. The
Data Tables plug-in is dependent on the tables ID and header
information stored in the <thead> section. Afer this, a bit of code
iterates through the IEnumerable<Title> passed in to the View from
the HomeController.cs fle and displays the Name, AverageRating
and Runtime values in the appropriate columns.
When the page initially starts up, the JavaScript method in the
header tag uses jQuery to locate the Netfix table in the form and
applies the dataTable function to it. DataTables is highly confgu-
rable, but with this simple form of calling the dataTable function,
the referenced table, Netflix, will acquire the DataTables default
confguration. Figure 3 shows the resulting page.
DataTables has done more than use CSS to make the table
pretty. Notice that, at the bottom, it tells you that it retrieved 155
rows. By default it does client-side paging starting at 10 entries per
page, although the user can choose 25, 50 or 100 entries per page
in the drop-down. Te Search box flters the results based on its
fndings in all of the available columns in the table. Te user can
also click on the header row columns to sort the data. Te Data-
Tables plug-in feature set is so rich that there are even plug-ins for
the plug-in. You can learn much more about enhancing the default
on the datatables.net Web site.
Querying OData on the Client Side
You dont always have the beneft of working with a client API, so
Ill fip over to the more challenging task of querying the Netfix
OData on the client side without the beneft of one of the other
available libraries (the AJAX client library). Ill employ the Data Tables
plug-in while getting around some of the limitations posed by the
Netfix service. Youre likely to run into these same limitations when
working with other public OData services as well.
For this round, Im using an ASP.NET WebForms app, though
I could be using plain old HTML because Im not using any .NET
Framework code in this page. Youll need the \media folder in this
application as well, but you wont be creating a proxy to the service,
so theres no need to use Add Service Reference.
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<IEnumerable<Title>>" %>
<%@ Import Namespace="JQueryMVC.Controllers" %>
<%@ Import Namespace="JQueryMVC.NetflixOData" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent"
runat="server">
Home Page
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent"
runat="server">
<head>
<link href="../../media/css/demo-table.css"
rel="stylesheet" type="text/css" />
<script src="../../media/js/jquery.js"
type="text/javascript"></script>
<script src="../../media/js/jquery.dataTables.js"
type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$('#Netflix').dataTable();
});
</script>
</head>
<div>
<table id="Netflix">
<thead><tr><th>Title</th>
<th>Rating</th>
<th>Runtime</th></tr></thead>
<tbody>
<% foreach (Title title in Model)
{ %>
<tr><td><%= title.Name %> </td>
<td><%= title.AverageRating %></td>
<td><%= title.Runtime %></td></tr>
<% } %>
</tbody>
</table>
</div>
</asp:Content>
Figure 2 The HomeController Index.aspx
Figure 3 Displaying Data with the DataTables Plug-In
DataTables has done more than
use CSS to make the table pretty.
21 February 2011 msdnmagazine.com
Te dataTable function has a method called sAjaxSource that
will automatically retrieve data from the target source. But this
requires your results to be formatted in a specific way. OData
results dont align with this. Theres a great blog post written by
a California-based developer, Jeff Morris, that demonstrates
reshaping OData results in a WCF Data Services query intercep-
tor. You can read the post at bit.ly/bMPzTH.
Instead, Ill use AJAX to return the OData in its native form and
then manually populate the table.
Te body of the page starts out with the table and its <theader>
defned (again, required by DataTables), as well as an empty <tbody>:
<body>
<form id="form1" runat="server">
<table id="Netflix" width="100%">
<thead>
<tr><th width="50%">Title</th>
<th>Rating</th>
<th>Runtime</th></tr>
</thead>
<tbody id="netflixBody"/>
</table>
</form>
</body>
Te page has a number of func-
tions: GetData, displayResults and
a helper function to deal with one
of the current shortcomings of the
Netfix service. Similar to the .NET
Client Library for OData, theres a
client library for AJAX thats part
of the Microsof ASP.NET AJAX
APIs. Heres an example from the
AJAX documentation of what a JavaScript OData query looks like
using this library:
function doQuery() {
var northwindService = new
Sys.Data.OpenDataServiceProxy("/Northwind.svc");
northwindService.query("/Customers", cbSuccess, cbFailure, userContext);
Alternatively, you can use straight AJAX and jQuery as I do in
the following examples. Lets look at the beginning of the header
script, including the getData function:
<script type="text/javascript" charset="utf-8">
var oTable;
var query = "http://odata.netflix.com/v1/Catalog/
Titles?$orderby=Name&$top=500"
$(document).ready(function () { getData() });
function getData() {
var url = query + "&$callback= displayResults"
+ "&$format=json";
$.ajax({ dataType: "jsonp", url: url });
}
When the page begins, the document.ready function automatically
calls getData. getData constructs a URL from the pre-defned OData
query and appends parameters to return the OData as JSON (an
alternative to the default AtomPub format), as well as defning the
method to be executed when the AJAX call is complete.
When the AJAX call is complete, the displayResults function will
be called using the results from the OData query (see Figure 4).
Te section of code thats commented with fnd data in results
is handling one of the Netfix limitations Ive mentioned. Netfix is
enforcing server-side paging to protect its servers and only returns
500 rows per request. Can you imagine if someone lazily queried
for all movies? Im sure that happens frequently. Te server- side
paging doesnt prevent you from getting additional rows; you just
need to do this explicitly.
Handling large amounts of data in the client is exactly what
DataTables is brilliant at, and theres a good chance youll want to
take advantage of it. It may take a bit longer to load all of the data
when youre retrieving large quantities (for example, 5,000 rows),
but once theyre in memory, DataTables can let the end user do all
types of fltering and sorting on that data.
When I frst saw DataTables demonstrated, the person showing
it of said they were using it for a corporate reporting tool where
they were downloading 80,000 rows. I protested loudly to this
abuse of the Internet and the server. However, having seen
DataTables in action, Im no longer so opposed to this usage in a
controlled scenario.
OData provides a way to easily request another batch of data
and Netfix provides this hook for you to take advantage of. Heres
a query that requests 501 results:
http://odata.netflix.com/v1/Catalog/Titles?$orderby=Name&$top=501
function displayResults(results) {
var entities;
var redraw;
// Find data in results
if (results.d[0] == undefined) {
queryNext = results.d.__next;
entities = results.d.results;
}
else {
queryNext = "";
entities = results.d;
}
// Instantiate dataTable if necessary
if (oTable ==null)
oTable = $('#Netflix').dataTable();
// Build table rows from data using dataTables.Add
for (var post in entities) {
if (post == queryResults.length-1)
redraw = true; //only redraw table on last item
else
redraw = false;
oTable.fnAddData([
entities[post].Name, entities[post].Rating,
entities[post].Runtime],redraw);
}
// Continue retrieving results
if (queryNext > "") {
query = FixNetFlixUrl(queryNext);
getData();
}
}
Figure 4 Preparing OData Results for Display
Figure 5 JSON Results of a Request for More Data than the Service Is Congured to Return
msdn magazine 22 Data Points
When the query exceeds that services limit, Netfix uses the OData
continuation token feature. In addition to the entries, the results contain
one more element afer the last entry. Here it is in AtomPub format:
<link rel="next"
href="http://odata.netflix.com:20000/v1/Catalog/Titles/?$orderby=
Name&$top=1&$skiptoken='1975%20Oklahoma%20National%20Championship%20
Game','BVZUb'" />
</feed>
Te skiptoken parameter tells the query where to start with the
next set of results. In JSON, that entry is seen at the beginning of
the results in a property called __next, as shown in Figure 5.
When a query doesnt exceed the limitation, the entries are directly
inside the d property, as you can see in Figure 6. Tats why GetData
needs to test to see where it will fnd the results. If theres a continuation
token, it stores that in NextQuery and then executes the continuation
query in order to build up the complete result set in memory.
If you look at the __next property, youll notice that Netflix
added a port number, 20,000, to the query. However, if you execute
that query directly, it will fail. So youll need to remove the port
number from the URI before requesting it. Tats the purpose of
the FixNetFlixUrl function that I call prior to making the request.
Youll have to watch for anomalies such as this when consuming
public OData services. Youve now seen how to deal with a service
that limits the number of results it will return and one that inficts
a breaking change in its continuation token.
For each set of results that is retrieved, the method uses the
DataTables fnAddData method to add each item to the table.
Redrawing the table is expensive, so Ive set the redraw parameter
of fnAddData to false until reaching the last item in the results.
Redrawing throughout the data retrieval makes the UI more fuid,
rather than waiting until all 5,000 rows have been retrieved and
added to the table.
After modifying the initial query to return 5,000 rows in my
rural-Vermont-with-poky-Internet-access environment, and
postponing the redraw to the bitter end, it took nearly a minute to
capture all of the rows and display the table. Redrawing every row
was much snappier and I was able to interact with the table even
as more rows were being added. Tat was a nice surprise.
Once all 5,000 rows were in the table, DataTables did an amazing
job of sorting and searching. Sorting took less than one second.
Search was instantaneous, as it responds to each keystroke in the
search box (see Figure 7).
A Small Adjustment for Internet Explorer 8
A recent update to DataTables triggers an Internet Explorer 8
feature thats not at all desirable when working with large result
sets in DataTables. Internet Explorer displays a warning message
when too many lines of script are being executed.
The Microsoft support site recommends adjusting the client
machines registry to change this behavior. Tats not a reasonable
solution for fxing this application; I don't want to mess with a cli-
ents registry settings if it can be avoided. But theres another option.
A post in the DataTables user forums suggested a modifcation
to the DataTables script fle. I implemented this modifcation and
it works like a charm. You can see the details in the forum thread
titled, Sorting causes IE to throw A script on this page is causing
Internet Explorer to run slowly, at bit.ly/co4AMD.
So Many Features to Explore
Hopefully youve already seen enough to understand my excitement
over this extensive plug-in. Teres a lot more that you can do to con-
fgure a tables lookas well as its behaviorin the read-only scenario
Ive demonstrated. DataTables also lets you edit in a fuid way, and if
you want to keep some of that logic on the server side, you can do that
while still benefting from DataTables.
Using DataTables to let your end users slice
and dice the large amounts of data available
in the increasing number of publicly avail-
able OData services seems, to me, like a match
made in geek heaven.
JULIE LERMAN is a Microsof MVP, .NET mentor and
consultant who lives in the hills of Vermont. You can fnd
her presenting on data access and other Microsof .NET
Framework topics at user groups and conferences around
the world. Lerman blogs at thedatafarm.com/blog and is
the author of the highly acclaimed book, Programming
Entity Framework (OReilly Media, 2010). Follow her
on Twitter.com: @julielerman.
THANKS to the following technical experts for
reviewing this article: Rey Bango and Alex James
Figure 6 JSON Results for a Request Within the Congured
Return Amount
Figure 7 Real-Time Search Results in DataTables
Toll Free USA (888) 774-3273 | Phone (913) 390-4797 | sales@spreadsheetgear.com
Download the FREE fully functional 30-Day
evaluation of SpreadsheetGear 2010 today at
www.SpreadsheetGear.com.
ASP.NET Excel Reporting

Easily create richly formatted Excel reports without Excel using the
new generation of spreadsheet technology built from the ground up
for scalability and reliability.
Excel Compatible Windows Forms Control

Add powerful Excel compatible viewing, editing, formatting, calculating,
charting and printing to your Windows Forms applications with the
easy to use WorkbookView control.
Create Dashboards from Excel Charts and Ranges

You and your users can design dashboards, reports, charts, and
models in Excel rather than hard to learn developer tools and you can
easily deploy them with one line of code.
In a League by Itself
SpreadsheetGear 2010 is Fantastic! These new capabilities just propelled
this control way-way past any competition, of which you have none IMHO.
SpreadsheetGear is in a league all by itself.
Greg Newman, Senior Software Engineer, WSFS Cash Connect
Untitled-9 1 11/2/10 12:11 PM
msdn magazine 24
drive up the cost beyond being cost-efective if it had to
exist in multiple places.
4. Burst times for synchronization; for example, end-of-day
processing for hundreds or thousands of retail locations
creates contention regardless of the partitioning.
Tis obviously doesnt exhaust all of the possible reasons that
would necessitate a design other than straight to SQL Azure for
synchronization, but its a good enough list to broach the topic and
take a look at how to solve the problem. As with most things in com-
puter science, Ill attempt to resolve the issues above by inserting
a layer of indirection. In this case, it will be a service layer hosted
in a Windows Azure Web Role used as the synchronization point
instead of synchronizing directly with the SQL Azure instance. Ive
updated the end state diagram from last month by adding a place-
holder for the Sync Service hosted in Windows Azure, arriving at
a logical design such as is shown Figure 1.
Getting Started
Te Sync Framework 4.0 is particularly suited to help solve this
problem. However, it will require that I do a bit more work than
the simple model of synchronizing directly between databases. Te
4.0 CTP shipped with a good sample and walk-through in the help
Branch-Node Synchronization with
SQL Azure, Part 2: Service-Based Sync
Last month, I focused on the gen-
eral architecture and design for syn-
chronizing corporate databases
with SQL Azure and with various
destination nodes from there. I
talked about optimizing by fltering
and also using geographic distri-
butionor using the two strate-
gies in conjunctionto optimize
the overall data distribution and
collection network.
Tis month, Im going to pull in
Windows Azure to host a synchro-
nization service and focus on syn-
chronizing via a service interface
in the cloud. This will provide a
means of scaling the synchroni-
zation mechanism to handle many more end nodes than could
be handled by direct-to-database synchronization. Ill use the
October 2010 Community Technology Preview (CTP) release of
the Microsof Sync Framework 4.0 (bit.ly/dpyMP8), which is built on
top of the 2.1 framework used in Januarys issue.
A synchronization service can be built straight on top of
version 2.1 and a good sample and walk-through can be found at
bit.ly/bibIdl and bit.ly/epyImQ. However, with the availability of the 4.0
CTP and the Internet-focused elements of the release, it makes
good sense to leverage it for the Windows Azure Sync Service. A
fair amount of code still needs to be written to make a functional
solution, but in the end, well end up with a synchronization service
that could be consumed by any device using OData.
Synchronizing at Internet Scale
I covered some ideas last month on how to scale the direct-to-
database sync. However, in someif not manycases there are
a number of reasons that the scale problem isnt so easily solved.
Giving just some cursory thought to things that wont be covered
by using the previously described approaches, one can easily come
up with the following:
1. Due to the relationship of the data, it cant easily be split.
2. Tere isnt segmentation that makes sense and any split
would be arbitrary, which would likely lead to unforeseen
hot-spots in the various partitions of the solution.
3. Te amount of data that would need to be replicated would
FORECAST: CLOUDY JOSEPH FULTZ
This article discusses a prerelease version of the Sync Framework 4.0;
all information is subject to change.
Figure 1 Typical Corporate Architecture
S
y
n
c

S
e
r
v
i
c
e
Corp Data
Distributor
SQL Azure
(U.S.)
SQL Azure
(Europe)
SQL Azure
(Asia)
Sync
Agent
U.S. Filter
Europe
Filter
Asia Filter
Workstations and POS
Back-of-House/
Branch Servers
Mobile Users
T
a
r
g
e
t
-
B
a
s
e
d

F
i
l
t
e
r
1210msdn_GrapeCity_Insert.indd 1 1/11/11 2:16 PM
1210msdn_GrapeCity_Insert.indd 2 1/11/11 2:16 PM
25 February 2011 msdnmagazine.com
fle, which is titled Creating a Sync Service in Windows Azure. Ill
use it as the basis for discussing the Sync Service implementation.
Te client code is a bit more dif cult because in version 4.0 there
isnt a client-side runtime library to assist, due to the abstraction
created to open up synchronization to any platform that will
work with OData. However, theres a sample in the 4.0 samples for
Windows Mobile 6.5 using SQL Server CE. Ive co-opted the code
needed and modifed it to work with standard SQL Server. To start,
the October 2010 4.0 CTP uses a certain set of objects to perform
the synchronization activity and it helps to be familiar with them.
The client application consumes a CacheController, which is
responsible for communication to the Sync Service using OData.
On the local side, the CacheController uses an Of ineSyncProvider,
which is the data-store-specifcand likely per-target-platform
interface between the application and the data (see Figure 2). In
this implementation, being based on the sample, theres a Storage-
Handler object used to handle the local data access. Te Of ine-
SyncProvider is a known type thats used by the CacheController,
but the StorageHandler is custom code written to handle all of the
back-end store interaction. Tink of the Of ineSyncProvider as
the intelligence on top of the data-access library and the Storage-
Handler as the data-access library. Notably, the 4.0 CTP only ships
with a built-in CacheController for Isolated Storage in a Silverlight
client, which leaves me with some work to do in order to use
standard SQL Server. The layout of the objects and interaction
boundaries are represented at a high level in Figure 2.
Developing the Cloud Sync Service
I was always told to deliver the bad news frst and the good news
last. Tat way, the conversationand hopefully the spirits of those
participating in itends on a positive note. However, in this case,
Im going to reverse the delivery order, hoping to sell the solution
on the merits of the easy part. Te bulk of the work comes on the
client side, but the framework provides a lot of assistance for the
server side. In a design session I lead, I was once told by someone
that sold death-care services (funerals, plots, cof ns and so on) that
theyd never make a single sale if they focused on what it is and
that instead the focus needed to be on what it does; in the case of
death care, peace of mind was the real commodity being bought,
not a cof n and hole in the ground. Such is the case with the Sync
Framework. Te Sync Framework 2.1 took care of a lot of things
for the developer, but it fell a little short of goal when it came to
service-based synchronization. It didnt at all address the plethora
of devices and platforms that might want to synchronize with the
data thats made available through an Internet-facing synchroniza-
tion service. With thenow popularly termedconsumerization
of IT, my customers fnd themselves having to deal with many
devices in the hands of people at all levels of the enterprise. Sync
Framework 4.0 CTP is aimed at helping with this type of chal-
lenge, particularly in regard to synchronizing data to those devices.
Getting the server side of this solution up and going is quite
simple. Basically, it comes down to these steps:
1. Defne the database
2. Create a confguration fle for it
3. Use the SyncServiceUtil to
provision the database using
the confg fle
4. Use the SyncServiceUtil to
generate classes required for
the synchronization service
5. Create a Windows Azure-based
Web Role to host the service
6. Deploy
If youre like me when you read
this summary, you think, what
confguration fle? Te schema for
the fle can be found in the MSDN
Library at bit.ly/h2FJod. Using that
and referencing the ListDB data-
base and the related confg fle for it
that ships with the 4.0 samples, one
can put together a custom confg
fle that represents a database with
Figure 2 Sync Framework 4.0 Client Synchronization Objects
Windows Azure
Data Synchronization
Service Interface
Local Client
Client Application
OfflineSyncProvider
StorageHandler
SQL
Express
CacheController
Figure 3 Object Browser View of SyncServices Generated Code
msdn magazine 26 Forecast: Cloudy
minimal confusion. Once this fle
exists, the creation of the Windows
Azure-based services is a snap.
First, the target databasein this
case the ListDB sample in the
4.0 SDKneeds to be created in
Windows Azure. Once thats done,
the new SyncServiceUtil can be
used to provision the database
using a command similar to:
SyncSvcUtil /mode:provision
/scopeconfig:listdbconfig.xml
Te one thing that will have to
be set in the confg fle is the con-
nection to the SQL Azure database.
Near the end of the confg fle is the
<TargetDatabase /> element, which
will need to be confgured properly for the cloud:
<Databases>
<TargetDatabase Name="listdb" DbServer="[URI for the SQL Azure DB
Instance]" DbName="listdb" UserName="[username]" Password="[password]"
UseIntegratedAuth="false" />
</Databases>
Running the utility will generate two fles: DefaultScopeEntities.cs
and DefaultScopeSyncServices.svc. Te DefaultScope part of the name
comes from the confg fle and is found in the element <SyncScope />:
<SyncScope Name="DefaultScope" IsTemplateScope="true">
Te entities fle is pretty much as described, but the DefaultScope-
SyncServices.svc fle is somewhat more signifcant as it generates
the partial class that allows me to intercept service calls and add
custom logic (something new to 4.0). Te base synchronization
logic is all included as part of the base object. Figure 3 shows the
DefaultScopeSyncService class and the related entities class as the
template type for the template class SyncService.
Note, on the right-hand side of Figure 3, the abbreviated list of
service interfaces that are exposed to do the synchronizing (as com-
pared to what would need to be exposed using Sync Framework 2.1
directly). If I wanted to add any custom logic to the synchronization
process, Id simply open the DefaultScopeSyncServices.svc file,
pick the method interceptor and write to my hearts content. To
implement basic synchronization via the service interface that
was just created, I simply need to associate the service/Web project
containing the fles with a Web Role and in the WebRole:OnStart
method add a line to create the activation context:
public override bool OnStart()
{
DiagnosticMonitor.Start("DiagnosticsConnectionString");
// For information on handling
// configuration changes, see the MSDN topic at
// go.microsoft.com/fwlink/?LinkId=166357
RoleEnvironment.Changing += RoleEnvironmentChanging;
Microsoft.Samples.Synchronization.ActivationContext.
CreateActivationContext();
return base.OnStart();
}
I then make a couple of confguration changes to ensure that the
Sync Framework binaries are set to CopyAlways. To get the new
service interface goodness, I ensure that the 4.0 Microsoft.Syn-
chronization.dll is both referenced and set to be published with
the package. Ten I publish it to my Web Role and Im ready to go.
I can make a simple test by requesting the sync scopes that are cur-
rently available by entering a request such as jofultz.cloudapp.net/
defaultscopeSyncService.svc/$syncscopes into my browser. I get
back the following response, which gives me some confdence that
the service is working:
- <service xml:base="http://rd00155d3a1a55:20000/
defaultscopesyncservice.svc/" xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://www.w3.org/2007/app">
- <workspace>
<atom:title>SyncScopes</atom:title>
- <collection href="defaultscope">
<atom:title>defaultscope</atom:title>
</collection>
</workspace>
</service>
I could also request other data, and if there are changes, Ill get
them as OData by default. I can do this in a browser or via a tool.
Using the OData Viewer Tool on CodePlex (dataservicestool.codeplex.com/
releases/view/52805), I issue the request to download changes:
jofultz.cloudapp.net/defaultscopeSyncService.svc/DefaultScope/
DownloadChanges?userid=BA9152CC-4280-4DAC-B32D-
1782E2E8C3D3, which gives me the results as shown in Figure 4.
Te great news here is that the additions in Sync Framework
4.0 CTP provide the simplifed synchronization interfaces with
results retrievable in OData ATOM and OData JSON. Tis opens
up the synchronization to other platforms from the client stand-
point and relegates proprietary data formats to being legacy
formatsand all I had to do was run a utility, confgure a project
and add a line of code.
Unit of Work Effort
DB Schema for Sync (Server) Conguration
Service Implementation Generated + 1 line of code
Customize Validation Hooks
in Sync
Hooks Generated; Only Have to Write
Value-Add Code
DB Schema for Sync (client) Could Use 2.1 Provisioning or Custom
Sync Implementation for
Non-Silverlight
Custom
Sync Client for Silverlight Conguration + Generation
Figure 5 Segmentation of Work for Client and Service
Figure 4 OData Viewer Tool DownloadChanges Result
DESIGN
Design Applications That Help Run the Business
Our xamMap control in Silverlight and
WPF lets you map out any geospatial
data like this airplane seating app to
manage your business. Come to
infragistics.comto try it today!
Infragistics Sales 800 231 8588
Infragistics Europe Sales +44 (0) 800 298 9055
Infragistics India +91 80 4151 8042
@infragistics
Untitled-6 1 11/10/10 11:41 AM
msdn magazine 28 Forecast: Cloudy
Implementing Client
Synchronization
Heres the point in the implementation where
the headphones go on and multitasking gives
way to focus. Te cloud service was almost
a matter of configuration, but the client
piece takes a bit more work if youre starting
from scratch. Because the Sync Framework
4.0 CTP ships with a CacheController for
isolated storage, if Silverlight is the target client
platform, then the client implementation will
be as easy as the cloud service implementa-
tion. However, my target is a Windows client
running SQL Server Standard/Express, and
that will require some efort. Te SyncService-
Util still assists by generating the needed
entities, but a custom CacheController and
Of ineSyncProvider will have to be created.
More importantly, the data store will need to
be modifed in order to facilitate the change
tracking. One might do this with a version
2.1-provisioned database or his own custom
schema for change tracking. Such an imple-
mentation could add significant work and
complexity to the overall application in terms
of a more complicated database implemen-
tation and a more complicated code base.
However, it needs to be done in order to
leverage the rest of the framework. In describ-
ing this to others, I get asked, Why not just do
it all yourself ? Te answer is simple: I do it this
way to reduce the body of work and open the
implementation to synchronization by other 2.1
and 4.0 framework sync clients/agents (includ-
ing non-Windows platforms).
Take a look at the segmentation of work
shown in Figure 5 for just the client and service
pieces being discussed. You can see that using
the framework reduces the amount of work by
roughly 60 percent or more depending on the
target client platform.
Working with the Mobile 6.5 and SQL CE
sample provides me with an example implemen-
tation of what you might do with the database in
order to implement the client synchronization;
note the IsDirty, IsTombstone and Metadata
felds as seen in Figure 6.
With a schema in place, I need a number of
other things:
1. CacheController implementation as
mentioned before
a. Local store interaction
b. Service interaction
c. Sync Confict Handler
d. Sync Error Handler
2. Some code to generate and consume
the OData
3. Code defnition for the entities
being synchronized
4. Of ineSyncProvider for the local
SQL Server database
For items 1 and 2, I use the code provided
for the 6.5 sample (see Figure 7) and place it
in my own CacheController project, which
consists entirely of code borrowed from
the sample.
I use the SyncServiceUtil to generate
the entities using the same config file as
before, along with the /mode:codegen
and /target:client flags. This generates a
DefaultScopeEntities.cs file that has my
client-side objects. Because Im stealing
from the 6.5 sample, I copy settings.cs,
utility.cs, SqlCeOfflineSyncProvider.cs,
DataStoreHelper.cs and SqlCeStorage-
Handler.cs to my Windows Forms project.
To minimize my coding effort I make the
changes shown in Figure 8.
By leveraging the sample code and making
those changes, Im able to write a small
console app that will call the Utility.Sync
function, which in turn instantiates the
Of ineSyncProvider and CacheController
to perform the synchronization:
var localProvider = new
SqlCeOfflineSyncProvider();
var controller = new CacheController(new
Uri(Settings.SyncServiceUrl), Settings.
SyncScope, localProvider);
So, one might ask, wheres the code to do
things like fetch changed records from the local
store? All of that lives in the StorageHandler
implementation. Take a look at Figure 9 to see
a piece of it.
Tus, the forward chain of operations works
as follows:
1. Client app calls arbitrary sync function
2. Sync function
a. Instantiates Of ineSyncProvider
b. Instantiates CacheController (this
one is custom), passing the service
URI and the Of ineSyncProvider
c. Finally calls CacheController.Refresh()
3. CacheController creates a Cache-
RequestHandler that will handle the
communication with the Sync Service
in Windows Azure
4. CachController asks the Of ineSync-
Provider for the local changeset
5. Te Of ineSyncProvider uses the
StorageHandler to retrieve the changes
from the local SQL Server
Figure 6 Columns to Support Custom
Synchronization Implementation
Figure 7 Files Used from the
6.5 Sample
DEVELOP
Rich Business Intelligence Applications in WPF and Silverlight
Infragistics Sales 800 231 8588
Infragistics Europe Sales +44 (0) 800 298 9055
Infragistics India +91 80 4151 8042
@infragistics
Robust Pivot Grids for WPF and
Silverlight let your users analyze data
to make key business decisions.
Visit infragistics.comto try it today!
Untitled-6 1 11/10/10 10:57 AM
msdn magazine 30 Forecast: Cloudy
6. CacheController uses the changeset to create a request
and pass it to the CacheRequestHandler
7. Te CacheRequestHandler uses the appropriate formatter
(OData ATOM here) to create a proper request and sends
it to the Sync Service URI
Of course, all of the unpacking and getting the data back to the
client pretty much is just the same stuf in reverse. Figure 4 shows
the OData package as it fows back from the service.
Final Thoughts
Obviously, removing transaction support and keeping misno-
mers such as SqlCe[suf x] for objects isnt the way to go for any real
implementation, but it served its purpose here to get a client version
working without writing all-new code. Anyone wanting to create a SQL
Server CacheController could easily start with the 6.5 sample and refac-
tor and rename, with the major work coming in the commands inside
of the StorageHandler that would need to be specifc to their data store.
My primary goal here was to demonstrate a service-based syn-
chronization architecture. I purposefully neglected caching and
other optimizations that would need to happen for it to scale, but
thats typically well understood. Also, I wanted to convey whats there,
what isnt and whats possible while familiarizing the reader with the
Sync Framework 4.0 CTP. I hope Ive accomplished these things.
With the SQL Azure Data Sync CTP 2 underway, theres the
promise of being able to set all of this upincluding the client
piecevia confguration and the download of a client-side agent.
Of course, that would be for Windows-based machines, but if
the goal was to reach a broader set of platforms, using the Sync
Framework 4.0 directly might be the better choice.
I want to encourage you to go out and download the latest Sync
Framework SDK and at least follow the tutorial to set up the sync
service in Windows Azure using a SQL Azure database and follow
the example for the Silverlight Client to get a feel for it. For those
who are a little braver, grab the fles as described from the Windows
Mobile 6.5 sample in the 4.0 CTP (there are two projects) and use
them to create your own Windows-based synchronization client.
JOSEPH FULTZ is an architect at the Microsof Technology Center in Dallas, where
he works with both enterprise cus tomers and ISVs designing and prototyping
sofware solu tions to meet business and market demands. Hes spoken at events
such as TechEd and similar internal training events.
THANKS to the following technical expert for reviewing this article:
Ganeshan Iyer
File / Project Change
DefaultScopeEntities.cs Rename the class to SqlCeOfineEntity in
order to match the expected type name in
the borrowed les
Add
[Microsoft.Samples.Synchronization.
ClientServices.KeyAttribute]
in each place where
[System.ComponentModel.DataAnnotations.
KeyAttribute()]
exists as its used within the
CacheController implementation
My new CacheController
Project
Replace all namespaces with
namespace Microsoft.Samples.
Synchronization.ClientServices.Custom
SqlCeOfineSyncProvider.cs Replace
using Microsoft.Samples.Synchronization.
ClientServices;
with
using Microsoft.Samples.Synchronization.
ClientServices.Custom;
to reference my custom CacheController
implementation
SqlCeStorageHandler.cs Comment out all [connection].[transaction
commands] from the le: working against
SQL Server requires a little different
implementation than SQL CE, and this
would need to be added back properly for
a real implementation
DataStoreHelper.cs Change the connection string to point to
my local SQL Server instance
Settings.cs Assign SyncServiceUrl the URI for
my Windows Azure Sync Service
(http://jofultz.cloudapp.net/
DefaultScopeSyncService.svc/)
Utility.cs Replace
using Microsoft.Samples.Synchronization.
ClientServices;
with
using Microsoft.Samples.Synchronization.
ClientServices.Custom;
to reference my custom CacheController
implementation
Figure 8 Changes to Sample Code Made to
Minimize Coding Effort
internal class SqlCeStorageHandler : IDisposable
{
#region SQL CE Commands
private const string GET_ALL_PRIORITY = "SELECT [ID], [Name], [_
MetadataID] FROM [Priority] WHERE [IsTombstone] = 0";
private const string GET_ALL_STATUS = "SELECT [ID], [Name], [_
MetadataID] FROM [Status] WHERE [IsTombstone] = 0";
private const string GET_ALL_TAGS = "SELECT [ID], [Name], [_
MetadataID] FROM [Tag] WHERE [IsTombstone] = 0";
private const string GET_ALL_LISTS =
"SELECT [ID], [Name], [Description], [UserID], [CreatedDate],
[IsTombstone], [_MetadataID] FROM [List] WHERE [IsTombstone] = 0";
private const string GET_ALL_ITEMS =
"SELECT ID, ListID, UserID, Name, Description, Priority, Status,
StartDate, EndDate, IsTombstone, [_MetadataID] FROM [Item] WHERE
[IsTombstone]=0 AND [ListID]=@ListID";
private const string SELECT_ITEM_CHANGES =
"SELECT ID, ListID, UserID, Name, Description, Priority, Status,
StartDate, EndDate, IsTombstone, [_MetadataID] FROM [Item] WHERE
IsDirty = 1";
private const string SELECT_LIST_CHANGES =
"SELECT ID, Name, Description, UserID, CreatedDate, IsTombstone,
[_MetadataID] FROM [List] WHERE IsDirty = 1";
private const string SELECT_TAGITEMMAPPING_CHANGES =
"SELECT TagID, ItemID, UserID, IsTombstone, [_MetadataID] FROM
[TagItemMapping] WHERE IsDirty = 1";
Figure 9 Local Store Data Commands
EXPERIENCE
Beautiful Data Visualizations That Bring Your Data to Life
Use our Motion Framework

to see your data


over time and give your users new insight
into their data. Visit infragistics.com/motion
to try it today!
Copyright 1996-2010 Infragistics, Inc. All rights reserved. Infragistics, the Infragistics logo and NetAdvantage are registered trademarks of Infragistics, Inc.
Motion Framework is a trademark of Infragistics, Inc.
Infragistics Sales 800 231 8588
Infragistics Europe Sales +44 (0) 800 298 9055
Infragistics India +91 80 4151 8042
@infragistics
Untitled-1 1 1/11/11 1:39 PM
Untitled-3 2 12/2/10 10:47 AM
Untitled-3 3 12/2/10 10:47 AM
msdn magazine 34
DYNAMI C . NET
Understanding the
Dynamic Keyword in C# 4
The dynamic keyword and the Dynamic Language
Runtime (DLR) are major new features in C# 4 and the Microsof
.NET Framework 4. Tese features generated a lot of interest when
announcedalong with a lot of questions. There were a number of
answers as well, but theyre now spread throughout documen-
tation and on various technical blogs and articles. So people
continue asking the same questions again and again on forums
and at conferences.
Tis article provides a general overview of the new dynamic fea-
tures in C# 4 and also delves into some more in-depth information
about how they work with other language and framework features,
such as refection or implicitly typed variables. Given theres a lot of
information available already, Ill sometimes reuse classic examples
with links to the original sources. Ill also provide plenty of links
for further reading.
Alexandra Rusina
What Is Dynamic?
Programming languages are sometimes divided into statically typed
and dynamically typed languages. C# and Java are ofen considered
examples of statically typed languages, while Python, Ruby and
JavaScript are examples of dynamically typed languages.
Generally speaking, dynamic languages dont perform compile-
time type checks and identify the type of objects at run time only.
Tis approach has its pros and cons: Ofen the code is much faster
and easier to write, but at the same time you dont get compiler
errors and have to use unit testing and other techniques to ensure
the correct behavior of your application.
Originally, C# was created as a purely static language, but with
C# 4, dynamic elements have been added to improve interoper-
ability with dynamic languages and frameworks. The C# team
considered several design options, but fnally settled on adding a
new keyword to support these features: dynamic.
Te dynamic keyword acts as a static type declaration in the C#
type system. Tis way C# got the dynamic features and at the same
time remained a statically typed language. Why and how this deci-
sion was made is explained in the presentation Dynamic Binding
in C# 4 by Mads Torgersen at PDC09 (microsoftpdc.com/2009/FT31).
Among other things, it was decided that dynamic objects should
be first-class citizens of the C# language, so theres no option to
switch dynamic features on or off, and nothing similar to the
Option Strict On/Of in Visual Basic was added to C#.
This article discusses:
Dynamic and type checking
Dynamic versus object and var
Using the DLR
Working with dynamic objects
Technologies discussed:
Microsoft .NET Framework 4, C# 4, Microsoft Ofce
35 February 2011 msdnmagazine.com
When you use the dynamic keyword you tell the compiler to turn
of compile-time checking. Tere are plenty of examples on the Web
and in the MSDN documentation (msdn.microsoft.com/library/dd264736)
on how to use this keyword. A common example looks like this:
dynamic d = "test";
Console.WriteLine(d.GetType());
// Prints "System.String".
d = 100;
Console.WriteLine(d.GetType());
// Prints "System.Int32".
As you can see, its possible to assign objects of diferent types
to a variable declared as dynamic. Te code compiles and the type
of object is identifed at run time. However, this code compiles as
well, but throws an exception at run time:
dynamic d = "test";
// The following line throws an exception at run time.
d++;
Te reason is the same: Te compiler doesnt know the runtime
type of the object and therefore cant tell you that the increment
operation is not supported in this case.
Absence of compile-time type checking leads to the absence
of IntelliSense as well. Because the C# compiler doesnt know the
type of the object, it cant enumerate its properties and methods.
Tis problem might be solved with additional type inference, as
is done in the IronPython tools for Visual Studio, but for now C#
doesnt provide it.
However, in many scenarios that might benefit from the
dynamic features, IntelliSense wasnt available anyway because
the code used string literals. Tis issue is discussed in more detail
later in this article.
Dynamic, Object or Var?
So whats the real diference between dynamic, object and var, and
when should you use them? Here are short definitions of each
keyword and some examples.
Te object keyword represents the System.Object type, which
is the root type in the C# class hierarchy. This keyword is often
used when theres no way to identify the object type at compile
time, which ofen happens in various interoperability scenarios.
You need to use explicit casts to convert a variable declared as
object to a specifc type:
object objExample = 10;
Console.WriteLine(objExample.GetType());
Tis obviously prints System.Int32. However, the static type is
System.Object, so you need an explicit cast here:
objExample = (int)objExample + 10;
You can assign values of diferent types because they all inherit
from System.Object:
objExample = "test";
Te var keyword, since C# 3.0, is used for implicitly typed local
variables and for anonymous types. Tis keyword is ofen used with
LINQ. When a variable is declared by using the var keyword, the
variables type is inferred from the initialization string at compile
time. Te type of the variable cant be changed at run time. If the
compiler cant infer the type, it produces a compilation error:
var varExample = 10;
Console.WriteLine(varExample.GetType());
Tis prints System.Int32, and its the same as the static type.
In the following example, no cast is required because varExamples
static typed is System.Int32:
varExample = varExample + 10;
Tis line doesnt compile because you can only assign integers
to varExample:
varExample = "test";
Te dynamic keyword, introduced in C# 4, makes certain scenar-
ios that traditionally relied on the object keyword easier to write and
maintain. In fact, the dynamic type uses the System.Object type under
the hood, but unlike object it doesnt require explicit cast operations at
compile time, because it identifes the type at run time only:
dynamic dynamicExample = 10;
Console.WriteLine(dynamicExample.GetType());
Tis prints System.Int32.
In the following line, no cast is required, because the type is iden-
tifed at run time only:
dynamicExample = dynamicExample + 10;
You can assign values of diferent types to dynamicExample:
dynamicExample = "test";
Teres a detailed blog post about diferences between the object
and dynamic keywords on the C# FAQ blog (bit.ly/c95hpl).
What sometimes causes confusion is that all of these keywords
can be used togethertheyre not mutually exclusive. For example,
lets take a look at this code:
dynamic dynamicObject = new Object();
var anotherObject = dynamicObject;
public class DynamicString : DynamicObject {
string str;
public DynamicString(string str) {
this.str = str;
}
public override bool TryInvokeMember(
InvokeMemberBinder binder, object[] args,
out object result) {
Console.WriteLine("Calling method: {0}", binder.Name);
try {
result = typeof(string).InvokeMember(
binder.Name,
BindingFlags.InvokeMethod |
BindingFlags.Public |
BindingFlags.Instance,
null, str, args);
return true;
}
catch {
result = null;
return false;
}
}
}
Figure 1 DynamicString
Generally speaking, dynamic
languages dont perform
compile-time type checks.
msdn magazine 36 Dynamic .NET
Whats the type of anotherObject?
Te answer is: dynamic. Remember that
dynamic is in fact a static type in the C#
type system, so the compiler infers this
type for the anotherObject. Its important
to understand that the var keyword is just
an instruction for the compiler to infer
the type from the variables initialization expression; var is not a type.
The Dynamic Language Runtime
When you hear the term dynamic in regard to the C# language,
it usually refers to one of two concepts: the dynamic keyword in
C# 4 or the DLR. Although these two concepts are related, its
important to understand the diference as well.
Te DLR serves two main goals. First, it enables interoperation
between dynamic languages and the .NET Framework. Second, it
brings dynamic behavior to C# and Visual Basic.
Te DLR was created based on lessons learned while building
IronPython (ironpython.net), which was the frst dynamic language im-
plemented on the .NET Framework. While working on IronPython,
the team found out that they could reuse their implementation
for more than one language, so they created a common underly-
ing platform for .NET dynamic languages. Like IronPython, the
DLR became an open source project and its source code is now
available at dlr.codeplex.com.
Later the DLR was also included in the .NET Framework 4
to support dynamic features in C# and Visual Basic. If you only
need the dynamic keyword in C# 4, you can simply use the .NET
Framework and in most cases it will handle all interactions with
the DLR on its own. But if you want to implement or port a new
dynamic language to .NET, you may beneft from the extra helper
classes in the open source project, which has more features and
services for language implementers.
Using Dynamic in a Statically Typed Language
Its not expected that everybody should use dynamic whenever
possible instead of the static type declarations. Compile-time
checking is a powerful instrument and the more benefts you can
get from it, the better. And once again, dynamic objects in C# do
not support IntelliSense, which might have a certain impact on
overall productivity.
At the same time, there are scenarios that were hard to implement
in C# prior to the dynamic keyword and the DLR. In most cases
they used System.Object type and explicit casting and couldnt get
much beneft from compile-time checking and IntelliSense any-
way. Here are some examples.
Te most notorious scenario is when
you have to use the object keyword for
interoperability with other languages or
frameworks. Usually you have to rely on
refection to get the type of the object and
to access its properties and methods. Te
syntax is sometimes hard to read and
consequently the code is hard to maintain. Using dynamic here
might be much easier and more convenient than refection.
Anders Hejlsberg gave a great example at PDC08 (channel9.msdn.com/
pdc2008/TL16) that looks like this:
object calc = GetCalculator();
Type calcType = calc.GetType();
object res = calcType.InvokeMember(
"Add", BindingFlags.InvokeMethod,
null, new object[] { 10, 20 });
int sum = Convert.ToInt32(res);
Te function returns a calculator, but the system doesnt know the
exact type of this calculator object at compile time. Te only thing
the code relies on is that this object should have the Add method.
Note that you dont get IntelliSense for this method because you
supply its name as a string literal.
With the dynamic keyword, this code looks as simple as this one:
dynamic calc = GetCalculator();
int sum = calc.Add(10, 20);
The assumptions are the same: Theres some object with an
unknown type that we expect to have the Add method. And similar
to the previous example, you dont get IntelliSense for this method.
But the syntax is much easier to read and use and looks similar to
calling a typical .NET method.
Dynamic Method Bags
Another example where dynamic can help is creating dynamic
method bags, which are objects that can add and remove properties
and methods at run time.
Te .NET Framework 4 has a new namespace: System.Dynamic.
Tis namespace is in fact a part of the DLR. Te System.Dynamic.Ex-
pando Object and System.Expando.DynamicObject classes in combi-
nation with the new dynamic keyword can help you to create dynamic
structures and hierarchies in a clear and easy-to-read way.
For example, heres how you can add a property and a method
by using the ExpandoObject class:
dynamic expando = new ExpandoObject();
expando.SampleProperty =
"This property was added at run time";
expando.SampleMethod = (Action)(
() => Console.WriteLine(expando.SampleProperty));
expando.SampleMethod();
For more in-depth scenarios, be sure to take a look at the MSDN
documentation for the ExpandoObject and DynamicObject classes.
Also, its worth reading through the articles Dynamic Method Bags by
Bill Wagner (msdn.microsoft.com/library/ee658247) and Dynamic in C# 4.0:
Introducing the ExpandoObject on the C# FAQ blog (bit.ly/amRYRw).
Class Wrappers
You can provide a better syntax for your own library or create a
wrapper for an existing library. Tis is a more advanced scenario
compared to the previous two and requires a deeper understanding
of the DLR specifcs.
Figure 2 Dynamic Object in Visual Studio
Another example where
dynamic can help is creating
dynamic method bags.
Untitled-1 1 1/11/11 11:44 AM
msdn magazine 38 Dynamic .NET
For simple cases you can use the DynamicObject class. In this
class you can mix static declaration of methods and properties
with the dynamic dispatch. So you can store an object for which
you want to provide better syntax in a class property, but handle all
operations with this object through a dynamic dispatch.
As an example, look at the DynamicString class in Figure 1 that
wraps a string and displays names of all methods before actually
calling those methods through refection.
To instantiate this class you should use the dynamic keyword:
dynamic dStr = new DynamicString("Test");
Console.WriteLine(dStr.ToUpper());
Console.ReadLine();
Of course, this particular example is contrived and not really
efficient. But if you have an API that already relies heavily on
refection, you can wrap all calls through refection as shown here
so the end users of your API wont see them.
For more examples, refer to MSDN documentation (msdn.micro soft.com/
library/system.dynamic.dynamicobject) and the Dynamic in C# 4.0:
Creating Wrappers with DynamicObject post on the C# FAQ
blog (bit.ly/dgS3od).
As I mentioned, the DynamicObject class provided by the DLR.
DynamicObject or ExpandoObject is all you need to produce a
dynamic object. However, some dynamic objects have a compli-
cated binding logic for accessing members or invoking methods.
Such objects need to implement the IDynamicMetaObjectProvider
interface and provide their own dynamic dispatch. This is an
advanced scenario and those who interested can read Implement-
ing Dynamic Interfaces by Bill Wagner (msdn.microsoft.com/vcsharp/
ff800651) and Getting Started with the DLR as a Library Author
by Alex Turner and Bill Chiles (dlr.codeplex.com).
Scriptable Applications
Scripts are a powerful way to provide extensibility for your
application. Microsoft Office can serve as a good example here:
numerous macros, add-ons and plug-ins exist due to Visual Basic
for Applications (VBA). And now the DLR enables you to create
scriptable applications because it provides a common set of host-
ing APIs for languages.
For example, you can create an application where users would
be able to add functionality themselves without asking for new
features from the main product, like adding new characters and
maps to a game or new graphs to a business application.
You have to use the open source version of the DLR from
dlr.codeplex.com instead of the one used by the .NET Framework 4
because, right now, the DLR scripting and hosting APIs are only avail-
able in the open source version. Also, its assumed that youll write scripts
not by using C#, but rather one of the .NET dynamic languages, such
as IronPython or IronRuby. However, any language can support
these APIs, even one thats not implemented on top of the DLR.
For details about using this functionality, watch the Using
Dynamic Languages to Build Scriptable Applications presentation
by Dino Viehland at PDC09 (microsoftpdc.com/2009/FT30).
Identifying Dynamic Objects
How can you distinguish dynamic objects from other objects? One
easy way is to use built-in IDE features. You can either hover the
mouse cursor over the object to see its declaration type or check
whether IntelliSense is available (see Figure 2).
At run time, however, things get more complicated. You cant
check whether the variable was declared by the dynamic keyword
the runtime type of the dynamic object is the type of the value it
stores and you cant get its static type declaration. Its the same as if
you declare your variable as object: At run time you can only get a
type of the value that the variable holds; you cant tell whether this
variable was originally declared as object.
What you can identify at run time is whether an object is coming
from the DLR. It might be important because objects of types like
ExpandoObject and DynamicObject can change their behavior at
run timefor example, add and delete properties and methods.
Also, you cant use standard refection methods to get informa-
tion about such objects. If you add a property to an instance of the
ExpandoObject class, you cant get this property from refection:
dynamic expando = new ExpandoObject();
expando.SampleProperty = "This property was added at run time";
PropertyInfo dynamicProperty =
expando.GetType().GetProperty("SampleProperty");
// dynamicProperty is null.
Te good thing is that, in the .NET Framework 4, all objects that
can dynamically add and remove members must implement one par-
ticular interface: System.Dynamic.IDynamicMetaObjectProvider.
Both DynamicObject and ExpandoObject classes implement
this interface, as well. However, this doesnt mean that any object
declared by using the dynamic keyword implements this interface:
dynamic expando = new ExpandoObject();
Console.WriteLine(expando is IDynamicMetaObjectProvider);
// True
dynamic test = "test";
Console.WriteLine(test is IDynamicMetaObjectProvider);
// False
// Add this line to the beginning of the file:
// using Excel = Microsoft.Office.Interop.Excel;
var excelApp = new Excel.Application();
excelApp.Workbooks.Add();
// excelApp.Workbooks.Add(Type.Missing);
excelApp.Visible = true;
Excel.Range targetRange = excelApp.Range["A1"];
// Excel.Range targetRange = excelApp.get_Range("A1", Type.Missing);
targetRange.Value = "Name";
// targetRange.set_Value(Type.Missing, "Name");
targetRange.Columns[1].AutoFit();
// ((Excel.Range)targetRange.Columns[1, Type.Missing]).AutoFit();
Figure 3 Scripting Excel with C#
The DLR enables you to create
scriptable applications because
it provides a common set of
hosting APIs for languages.
39 February 2011 msdnmagazine.com
So, if youre using dynamic along with refection, remember that
refection wont work for dynamically added properties and methods,
and it might be a good idea to check whether the object youre
refecting on implements the IDynamicMetaObjectProvider interface.
Dynamic and COM Interop
Te COM interop scenario that the C# team specifcally targeted
in the C# 4 release was programming against Microsoft Office
applications, such as Word and Excel. Te intent was to make this
task as easy and natural in C# as it always
was in Visual Basic. Tis is also a part of the
Visual Basic and C# co-evolution strategy,
where both languages aim at feature parity
and borrow the best and most productive
solutions from one another.
If youre interested in the details, read C#
and VB coevolution on Scott Wiltamuths
Visual Studio blog (bit.ly/bFUpxG).
Figure 3 shows the C# 4 code that adds a
value to the frst cell in the Excel worksheet
and then applies the AutoFit method to the
frst column. Te comments under each line
show equivalents from C# 3.0 and earlier.
Te interesting thing about this example
is that you cant see the dynamic keyword
anywhere in the code. In fact, its used in
just one line here:
targetRange.Columns[1].AutoFit();
// ((Excel.Range)targetRange.Columns[1, Type.
Missing]).AutoFit();
In the C# 3.0 version, targetRange.Col-
umns[1, Type.Missing] returns object, and
thats why the casting to Excel.Range is nec-
essary. But in C# 4 and Visual Studio 2010
such calls are silently converted into dynamic
ones. So, the type of the targetRange.Col-
umns[1] in C# 4 is actually dynamic.
Another highlight is that the COM inter-
op improvements in C# 4 are not just
about dynamic. In all other lines better
syntax is achieved because of other new
features such as indexed properties and
named and optional parameters. You can
fnd a good overview of these new features
in the MSDN Magazine article New C#
Features in the .NET Framework 4 by Chris
Burrows (msdn.microsoft.com/magazine/ff796223).
Where Can I Get
More Information?
Hopefully this article covered most of the
questions you might have about the dynamic
keyword in C# 4, but Im sure it didnt cov-
er everything. If you have comments, ques-
tions or suggestions, drop by dlr.codeplex.com/
discussions and ask away. Someone may have
already asked about the issue, or you can create a new discussion.
We have an active community and welcome new members.
ALEXANDRA RUSINA is a program manager on the Silverlight team. Prior to that
she worked as a programming writer on the Visual Studio Languages team during
the Visual Studio 2010 release. She also regularly blogged on the C# Frequently
Asked Question blog (blogs.msdn.com/b/csharpfaq/).
THANKS to the following technical expert for reviewing this article: Bill Chiles
1987-2010 ComponentOne LCC. All rights reserved. All other product and brand
names are trademarks and/or registered trademarks of their respective holders.
Untitled-4 2 11/8/10 2:58 PM
Untitled-4 3 11/8/10 2:58 PM
msdn magazine 42
DATA CONTRACT I NHERI TANCE
Known Types and the
Generic Resolver
Ever since its first release, Windows Communication
Foundation (WCF) developers have had to deal with the hassles
of data contract inheritance, a problem called known types. In
this article I first explain the origin of the problem, discuss the
available mitigations in the Microsof .NET Framework 3.0 and
the .NET Framework 4, and then present my technique that can
eliminate the problem altogether. Youll also see some advanced
WCF programming techniques.
By Value vs. by Reference
In traditional object-oriented languages such as C++ and C#, a
derived class maintains an is-a relationship with its base class. Tis
means that given this declaration, every B object is also an A object:
class A {...}
class B : A {...}
Juval Lowy
Graphically, this looks like the Venn diagram in Figure 1, in which
every B instance is also an A instance (but not every A is necessarily a B).
From a traditional object-orientation domain-modeling perspec-
tive, the is-a relationship enables you to design your code against
the base class while interacting with a subclass. Tis means you can
evolve the modeling of domain entities over time while minimizing
the impact on the application.
For example, consider a business contacts management appli-
cation with this modeling of a base type called Contact and a
derived class called Customer that specializes the contact by adding
to it the attributes of a customer:
class Contact {
public string FirstName;
public string LastName;
}
class Customer : Contact {
public int OrderNumber;
}
Any method in the application thats written initially against the
Contact type can accept Customer objects as well, as show in Figure 2.
The reason the code in Figure 2 works at all has to do with
the way the compiler represents the object state in memory. To
support the is-a relationship between a subclass and its base class,
when allocating a new subclass instance the compiler frst allocates
the base class portion of the state of the object, then appends
directly afer it the subclass portion, as shown in Figure 3.
When a method that expects a reference to a Contact is actually
given a reference to a Customer, it still works because the Customer
reference is a reference to a Contact as well.
This article discusses:
The known type crutches
Data contract resolvers
The generic resolver
The generic resolver attribute
Technologies discussed:
Windows Communication Foundation
Code download available at:
code.msdn.microsoft.com/mag201102Resolver
43 February 2011 msdnmagazine.com
Unfortunately, this intricate setup breaks when
it comes to WCF. Unlike traditional object orienta-
tion or the classic CLR programming model, WCF
passes all operation parameters by value, not by
reference. Even though the code looks like the
parameters are passed by reference (as in regular
C#), the WCF proxy actually serializes the param-
eters into the message. Te parameters are packaged
in the WCF message and transferred to the service,
where they are then deserialized to local references
for the service operation to work with.
Tis is also what happens when the service operation returns
results to the client: Te results (or outgoing parameters, or excep-
tions) are frst serialized into a reply message and then deserialized
back on the client side.
Te exact form of the serialization that takes place is usually a
product of the data contract the service contract is written against.
For example, consider these data contracts:
[DataContract]
class Contact {...}
[DataContract]
class Customer : Contact {...}
Using these data contracts, you can defne this service contract:
[ServiceContract]
interface IContactManager {
[OperationContract]
void AddContact(Contact contact);
[OperationContract]
Contact[] GetContacts();
}
With multitier applications, marshaling the parameters by value
works better than by reference because any layer in the architecture
is at liberty to provide its own interpretation to the behavior behind
the data contract. Marshaling by value also enables remote calls,
interoperability, queued calls and long-running workfows.
But unlike traditional object orientation, the service operation writ-
ten against the Contact class cant by default work with the customer
subclass. Te reason is simple: If you do pass a subclass reference to
a service operation that expects a base class reference, how would
WCF know to serialize into the message the derived class portion?
As a result, given the defnitions so far, this WCF code will fail:
class ContactManagerClient : ClientBase<IContactManager> :
IContactManager{
...
}
IContactManager proxy = new ContactManagerClient();
Contact contact = new Customer();
// This will fail:
contacts.AddContact(contact);
The Known Type Crutches
With the .NET Framework 3.0, WCF was able to address the
problem of substituting a base class reference with a subclass using
the KnownTypeAttribute, defned as:
[AttributeUsage(AttributeTargets.Struct|AttributeTargets.Class,
AllowMultiple = true)]
public sealed class KnownTypeAttribute : Attribute {
public KnownTypeAttribute(Type type);
//More members
}
Te KnownType attribute allows you to designate
acceptable subclasses for the data contract:
[DataContract]
[KnownType(typeof(Customer))]
class Contact {...}
[DataContract]
class Customer : Contact {...}
When the client passes a data contract that uses a
known type declaration, the WCF message formatter
tests the type (akin to using the is operator) and sees
if its the expected known type. If so, it serializes the
parameter as the subclass rather than the base class.
Te KnownType attribute afects all contracts and operations
using the base class, across all services and endpoints, allow-
ing it to accept subclasses instead of base classes. In addition, it
includes the subclass in the metadata so that the client will have its
own defnition of the subclass and will be able to pass the subclass
instead of the base class.
When multiple subclasses are expected, the developer must list
all of them:
[DataContract]
[KnownType(typeof(Customer))]
[KnownType(typeof(Person))]
class Contact {...}
[DataContract]
class Person : Contact {...}
Te WCF formatter uses refection to collect all the known types
of the data contracts, then examines the provided parameter to see
if its of any of the known types.
Note that you must explicitly add all levels in the data contract
class hierarchy. Adding a subclass doesnt add its base classes:
[DataContract]
[KnownType(typeof(Customer))]
[KnownType(typeof(Person))]
class Contact {...}
[DataContract]
class Customer : Contact {...}
[DataContract]
class Person : Customer {...}
Because the KnownType attribute may be too broad in scope,
WCF also provides ServiceKnownTypeAttribute, which you can
apply on a specifc operation or on a specifc contract.
interface IContactManager {
void AddContact(Contact contact);
Contact[] GetContacts();
}
class AddressBook : IContactManager {
public void AddContact(Contact contact)
{...}
...
}
IContactManager contacts = new AddressBook();
Contact contact1 = new Contact();
Contact contact2 = new Customer();
Customer customer = new Customer();
contacts.AddContact(contact1);
contacts.AddContact(contact2);
contacts.AddContact(customer);
Figure 2 Interchanging Base Class and Sub Class References
Figure 1 Is-A Relationship
A
B
msdn magazine 44 Data Contract Inheritance
Finally, in the .NET Framework 3.0, WCF also allowed listing
the expected known types in the application config file in the
system.runtime.serialization section.
While using known types technically works just fne, you should
feel some unease about it. In traditional object-oriented modeling
you never want to couple the base class to any specifc subclasses.
Te hallmark of a good base class is precisely that: a good base is a
good base class for any possible subclass, and yet the known types
issue makes it adequate only for subclasses it happens to know
about. If you do all your modeling up-front when designing
the system, that may not be a hindrance. In reality, over time, as
the application evolves its modeling, youll encounter as-yet-
unknown types that will force you to, at the very least, redeploy
your applicationand, more likely, to also modify your base classes.
Data Contract Resolvers
To alleviate the problem, in the .NET Framework 4 WCF
introduced a way of resolving the known types at run time. Tis
programmatic technique, called data contract resolvers, is the
most powerful option because you can extend it to completely
automate dealing with the known type issues. In essence, youre
given a chance to intercept the operations attempt to serialize and
deserialize parameters and resolve the known types at run time
both on the client and service sides.
Te frst step in implementing a programmatic resolution is to
derive from the abstract class DataContractResolver, defned as:
public abstract class DataContractResolver {
protected DataContractResolver();

public abstract bool TryResolveType(
Type type,Type declaredType,
DataContractResolver knownTypeResolver,
out XmlDictionaryString typeName,
out XmlDictionaryString typeNamespace);
public abstract Type ResolveName(
string typeName,string typeNamespace,
Type declaredType,
DataContractResolver knownTypeResolver);
}
Your implementation of TryResolveType is called when WCF
tries to serialize a type into a message and the type provided
(the type parameter) is different from the type declared in the
operation contract (the declaredType parameter). If you want to
serialize the type, you need to provide some unique identifers to
serve as keys into a dictionary that maps identifers to types. WCF
will provide those keys during deserialization so that you can bind
against that type.
Note that the namespace key cant be an empty string or a null.
While virtually any unique string value will do for the identifers,
I recommend simply using the CLR type name and namespace.
Set the type name and namespace into the typeName and
typeNamespace out parameters.
If you return true from TryResolveType, the type is considered
resolved, as if you had applied the KnownType attribute. If you
return false, WCF fails the call. Note that TryResolveType must
resolve all known types, even those types that are decorated with
the KnownType attribute or are listed in the confg fle. Tis presents
a potential risk: It requires the resolver to be coupled to all known
types in the application and will fail the operation call with other
types that may come over time. Its therefore preferable as a fall-
back contingency to try to resolve the type using the default known
types resolver that WCF wouldve used if your resolver was not in
use. Tis is exactly what the knownTypeResolver parameter is for.
If your implementation of TryResolveType cant resolve the type,
it should delegate to knownTypeResolver.
ResolveName is called when WCF tries to deserialize a type
out of a message and the type provided (the type parameter) is
different from the type declared in the operation contract (the
declaredType parameter). In this case, WCF provides the type
name and namespace identifiers so that you can map them back
to a known type.
class CustomerResolver : DataContractResolver {
string Namespace {
get {
return typeof(Customer).Namespace ?? "global";
}
}
string Name {
get {
return typeof(Customer).Name;
}
}
public override Type ResolveName(
string typeName,string typeNamespace,
Type declaredType,
DataContractResolver knownTypeResolver) {
if(typeName == Name && typeNamespace == Namespace) {
return typeof(Customer);
}
else {
return knownTypeResolver.ResolveName(
typeName,typeNamespace,declaredType,null);
}
}
public override bool TryResolveType(
Type type,Type declaredType,
DataContractResolver knownTypeResolver,
out XmlDictionaryString typeName,
out XmlDictionaryString typeNamespace) {
if(type == typeof(Customer)) {
XmlDictionary dictionary = new XmlDictionary();
typeName = dictionary.Add(Name);
typeNamespace = dictionary.Add(Namespace);
return true;
}
else {
return knownTypeResolver.TryResolveType(
type,declaredType,null,out typeName,out typeNamespace);
}
}
}
Figure 4 The CustomerResolver
Figure 3 Object State Hierarchy in Memory
contact
customer
c
o
n
t
a
c
t
c
u
s
t
o
m
e
r
Create accurate PDF documents in a fraction of the time needed
with other tools
WHQL tested for all Windows 32 and 64-bit platforms
Produce fully compliant PDF/A documents
Standard PDF features included with a number of unique features
Interface with any .NET or ActiveX programming language
High-Performance PDF Printer Driver
Edit, process and print PDF 1.7 documents programmatically
Fast and lightweight 32 and 64-bit managed code assemblies
for Windows, WPF and Web applications
Support for dynamic objects such as edit-fields and sticky-notes
Save image files directly to PDF, with optional OCR
Multiple image compression formats such as PNG, JBIG2 and TIFF

USA and Canada


Toll Free: 1 866 926 9864
Support: (514) 868 9227
Info: sales@amyuni.com
Europe
Sales: (+33) 1 30 61 07 97
Support: (+33) 1 30 61 07 98
Customizations: management@amyuni.com
All trademarks are property of their respective owners. 1999-2010 AMYUNI Technologies. All rights reserved.
www.amyuni.com
New Touchscreen Tablet
for Mobile Development!
The DevTouch Pro is a new color
touchscreen tablet designed to provide
mobile application developers with a
customizable develo pment, testing
and deployment platform.
Fully open customizable tablet
Develop with .NET, Java or C++
Unrestricted development and
flexible quantities
Fully supported in North America
Learn more at www.devtouchpro.com
PDF Integration into Silverlight Applications
More Development Tools Available at:
v4.5!
v4.5!
New!
PDF Editor for .NET, now Webform Enabled
Server-side PDF component based on the robust Amyuni PDF
Creator ActiveX or .NET components
Client-side C# Silverlight 3 control provided with source-code
Optimization of PDF documents prior to converting them into XAML
Conversion of PDF edit-boxes into Silverlight TextBox objects
Support for other document formats such as TIFF and XPS

Untitled-3 1 11/8/10 2:53 PM


msdn magazine 46 Data Contract Inheritance
As an example, consider again these two data contracts:
[DataContract]
class Contact {...}
[DataContract]
class Customer : Contact {...}
Figure 4 lists a simple resolver for the Customer type.
Te resolver must be attached as a behavior for each operation
on the proxy or the service endpoint. Te ServiceEndpoint class
has a property called Contract of the type ContractDescription:
public class ServiceEndpoint {
public ContractDescription Contract
{get;set;}
// More members
}
ContractDescription has a collection of operation descriptions, with
an instance of OperationDescription for every operation on the contract:
public class ContractDescription {
public OperationDescriptionCollection Operations
{get;}
// More members
}
public class OperationDescriptionCollection :
Collection<OperationDescription>
{...}
Each OperationDescription has a collection of operation behaviors
of the type IOperationBehavior:
public class OperationDescription {
public KeyedByTypeCollection<IO perationBehavior> Behaviors
{get;}
// More members
}
In its collection of behaviors, every operation always has a
behavior called DataContractSerializerOperationBehavior with
a DataContractResolver property:
public class DataContractSerializerOperationBehavior :
IOperationBehavior,... {
public DataContractResolver DataContractResolver
{get;set}
// More members
}
The DataContractResolver property defaults to null, but you
can set it to your custom resolver. To install a resolver on the host
side, you must iterate over the collection of endpoints in the service
description maintained by the host:
public class ServiceHost : ServiceHostBase {...}
public abstract class ServiceHostBase : ... {
public ServiceDescription Description
{get;}
// More members
}
public class ServiceDescription {
public ServiceEndpointCollection Endpoints
{get;}
// More members
}
public class ServiceEndpointCollection :
Collection<ServiceEndpoint> {...}
Suppose you have the following service defnition and are using
the resolver in Figure 4:
[ServiceContract]
interface IContactManager {
[OperationContract]
void AddContact(Contact contact);
...
}
class AddressBookService : IContactManager {...}
Figure 5 shows how to install the resolver on the host for the
AddressBookService.
On the client side, you follow similar steps, except you need to
set the resolver on the single endpoint of the proxy or the channel
factory. For example, given this proxy class defnition:
class ContactManagerClient : ClientBase<IContactManager>,IContactManager
{...}
Figure 6 shows how to install the resolver on the proxy in order
to call the service of Figure 5 with a known type.
The Generic Resolver
Writing and installing a resolver for each type is obviously
a lot of work, requiring you to meticulously track all known
typessomething thats error-prone and can quickly get out of
hand in an evolving system. To automate implementing a resolver,
I wrote the class GenericResolver, defned as:
public class GenericResolver : DataContractResolver {
public Type[] KnownTypes
{get;}
public GenericResolver();
public GenericResolver(Type[] typesToResolve);
public static GenericResolver Merge(
GenericResolver resolver1,
GenericResolver resolver2);
}
GenericResolver ofers two constructors. One constructor can
accept an array of known types to resolve. Te parameterless con-
structor will automatically add as known types all classes and
structs in the calling assembly and all public classes and structs in
assemblies referenced by the calling assembly. Te parameterless
ServiceHost host =
new ServiceHost(typeof(AddressBookService));
foreach(ServiceEndpoint endpoint in
host.Description.Endpoints) {
foreach(OperationDescription operation in
endpoint.Contract.Operations) {
DataContractSerializerOperationBehavior behavior =
operation.Behaviors.Find<
DataContractSerializerOperationBehavior>();
behavior.DataContractResolver = new CustomerResolver();
}
}
host.Open();
Figure 5 Installing a Resolver on the Host
ContactManagerClient proxy = new ContactManagerClient();
foreach(OperationDescription operation in
proxy.Endpoint.Contract.Operations) {
DataContractSerializerOperationBehavior behavior =
operation.Behaviors.Find<
DataContractSerializerOperationBehavior>();

behavior.DataContractResolver = new CustomerResolver();
}
Customer customer = new Customer();
...
proxy.AddContact(customer);
Figure 6 Installing a Resolver on the Proxy
Untitled-11 1 1/7/11 4:08 PM
msdn magazine 48 Data Contract Inheritance
constructor wont add types originating in a .NET Framework-
referenced assembly.
In addition, GenericResolver ofers the Merge static method that
you can use to merge the known types of two resolvers, returning a
GenericResolver that resolves the union of the two resolvers pro-
vided. Figure 7 shows the pertinent portion of GenericResolver
without refecting the types in the assemblies, which has nothing
to do with WCF.
The most important members of GenericResolver are the
m_TypeToNames and the m_NamesToType dictionaries.
m_TypeToNames maps a type to a tuple of its name and name-
space. m_NamesToType maps a type namespace and name to the
actual type. Te constructor that takes the array of types initial-
izes those two dictionaries. Te TryResolveType method uses the
provided type as a key into the m_TypeToNames dictionary to read
the types name and namespace. Te ResolveName method uses the
provided namespace and name as keys into the m_NamesToType
dictionary to return the resolved type.
While you could use tedious code similar to Figure 5 and Figure
6 to install GenericResolver, its best to streamline it with extension
methods. To that end, use my AddGenericResolver methods of
GenericResolverInstaller, defned as:
public static class GenericResolverInstaller {
public static void AddGenericResolver(
this ServiceHost host, params Type[] typesToResolve);
public static void AddGenericResolver<T>(
this ClientBase<T> proxy,
params Type[] typesToResolve) where T : class;
public static void AddGenericResolver<T>(
this ChannelFactory<T> factory,
params Type[] typesToResolve) where T : class;
}
The AddGenericResolver method accepts a params array of
types, which means an open-ended, comma-separated list of types.
If you dont specify types, that will make AddGenericResolver
add as known types all classes and structs in the calling assembly
plus the public classes and structs in referenced assemblies. For
example, consider these known types:
[DataContract]
class Contact {...}
[DataContract]
class Customer : Contact {...}
[DataContract]
class Employee : Contact {...}
public class GenericResolver : DataContractResolver {
const string DefaultNamespace = "global";

readonly Dictionary<Type,Tuple<string,string>> m_TypeToNames;
readonly Dictionary<string,Dictionary<string,Type>> m_NamesToType;
public Type[] KnownTypes {
get {
return m_TypeToNames.Keys.ToArray();
}
}
// Get all types in calling assembly and referenced assemblies
static Type[] ReflectTypes() {...}
public GenericResolver() : this(ReflectTypes()) {}
public GenericResolver(Type[] typesToResolve) {
m_TypeToNames = new Dictionary<Type,Tuple<string,string>>();
m_NamesToType = new Dictionary<string,Dictionary<string,Type>>();
foreach(Type type in typesToResolve) {
string typeNamespace = GetNamespace(type);
string typeName = GetName(type);
m_TypeToNames[type] = new Tuple<string,string>(typeNamespace,typeName);
if(m_NamesToType.ContainsKey(typeNamespace) == false) {
m_NamesToType[typeNamespace] = new Dictionary<string,Type>();
}
m_NamesToType[typeNamespace][typeName] = type;
}
}
static string GetNamespace(Type type) {
return type.Namespace ?? DefaultNamespace;
}
static string GetName(Type type) {
return type.Name;
}
public static GenericResolver Merge(
GenericResolver resolver1, GenericResolver resolver2) {
if(resolver1 == null) {
return resolver2;
}
if(resolver2 == null) {
return resolver1;
}
List<Type> types = new List<Type>();
types.AddRange(resolver1.KnownTypes);
types.AddRange(resolver2.KnownTypes);
return new GenericResolver(types.ToArray());
}
public override Type ResolveName(
string typeName,string typeNamespace,
Type declaredType,
DataContractResolver knownTypeResolver) {
if(m_NamesToType.ContainsKey(typeNamespace)) {
if(m_NamesToType[typeNamespace].ContainsKey(typeName)) {
return m_NamesToType[typeNamespace][typeName];
}
}
return knownTypeResolver.ResolveName(
typeName,typeNamespace,declaredType,null);
}
public override bool TryResolveType(
Type type,Type declaredType,
DataContractResolver knownTypeResolver,
out XmlDictionaryString typeName,
out XmlDictionaryString typeNamespace) {
if(m_TypeToNames.ContainsKey(type)) {
XmlDictionary dictionary = new XmlDictionary();
typeNamespace = dictionary.Add(m_TypeToNames[type].Item1);
typeName = dictionary.Add(m_TypeToNames[type].Item2);
return true;
}
else {
return knownTypeResolver.TryResolveType(
type,declaredType,null,out typeName,
out typeNamespace);
}
}
}
Figure 7 Implementing GenericResolver (Partial)
Untitled-2 1 1/12/11 10:27 AM
msdn magazine 50 Data Contract Inheritance
Figure 8 shows several examples of using the AddGeneric-
Resolver extension method for these types.
GenericResolverInstaller not only installs the GenericResolver,
it also tries to merge it with the old generic resolver (if present).
Tis means you can call the AddGenericResolver method multiple
times. Tis is handy when adding bounded generic types:
[DataContract]
class Customer<T> : Contact {...}
ServiceHost host = new ServiceHost(typeof(AddressBookService));
// Add all non-generic known types
host.AddGenericResolver();
// Add the generic types
host.AddGenericResolver(typeof(Customer<int>,Customer<string>));
host.Open();
Figure 9 shows partial implementation of GenericResolverInstaller.
If no types are provided, AddGenericResolver will use the
parameterless constructor of GenericResolver. Otherwise, it will
use only the specifed types by calling the other constructor. Note
the merging with the old resolver if present.
The Generic Resolver Attribute
If your service relies on the generic resolver by design, its better
not to be at the mercy of the host and to declare your need for the
generic resolver at design time. To that end, I wrote the Generic-
ResolverBehaviorAttribute:
[AttributeUsage(AttributeTargets.Class)]
public class GenericResolverBehaviorAttribute :
Attribute,IServiceBehavior {
void IServiceBehavior.Validate(
ServiceDescription serviceDescription,
ServiceHostBase serviceHostBase) {
ServiceHost host = serviceHostBase as ServiceHost;
host.AddGenericResolver();
}
// More members
}
Tis concise attribute makes the service independent of the host:
[GenericResolverBehavior]
class AddressBookService : IContactManager {...}
GenericResolverBehaviorAttribute derives from IService-
Behavior, which is a special WCF interface and is the most
commonly used extension in WCF. When the host loads the
service, the host calls the IServiceBehavior methodsspecifcally
the Validate methodwhich lets the attribute interact with the
host. In the case of GenericResolverBehaviorAttribute, it adds the
generic resolver to the host.
And there you have it: a relatively simple and flexible way to
bypass the hassles of data contract inheritance. Put this technique
to work in your next WCF project.
JUVAL LOWY is a sofware architect with IDesign providing .NET and architec-
ture training and consulting. Tis article contains excerpts from his recent book,
Programming WCF Services, 3rd Edition (O'Reilly, 2010). Hes also the Microsof
Regional Director for the Silicon Valley. Contact Lowy at idesign.net.
THANKS to the following technical experts for reviewing this article:
Glenn Block and Amadeo Casas Cuadrado
// Host side
ServiceHost host1 = new ServiceHost(typeof(AddressBookService));
// Resolve all types in this and referenced assemblies
host1.AddGenericResolver();
host1.Open();
ServiceHost host2 = new ServiceHost(typeof(AddressBookService));
// Resolve only Customer and Employee
host2.AddGenericResolver(typeof(Customer),typeof(Employee));
host2.Open();
ServiceHost host3 = new ServiceHost(typeof(AddressBookService));
// Can call AddGenericResolver() multiple times
host3.AddGenericResolver(typeof(Customer));
host3.AddGenericResolver(typeof(Employee));
host3.Open();
// Client side
ContactManagerClient proxy = new ContactManagerClient();
// Resolve all types in this and referenced assemblies
proxy.AddGenericResolver();
Customer customer = new Customer();
...
proxy.AddContact(customer);
Figure 8 Installing GenericResolver
public static class GenericResolverInstaller {
public static void AddGenericResolver(
this ServiceHost host, params Type[] typesToResolve) {
foreach(ServiceEndpoint endpoint in
host.Description.Endpoints) {
AddGenericResolver(endpoint,typesToResolve);
}
}
static void AddGenericResolver(
ServiceEndpoint endpoint,Type[] typesToResolve) {
foreach(OperationDescription operation in
endpoint.Contract.Operations) {
DataContractSerializerOperationBehavior behavior =
operation.Behaviors.Find<
DataContractSerializerOperationBehavior>();
GenericResolver newResolver;
if(typesToResolve == null ||
typesToResolve.Any() == false) {
newResolver = new GenericResolver();
}
else {
newResolver = new GenericResolver(typesToResolve);
}
GenericResolver oldResolver =
behavior.DataContractResolver as GenericResolver;
behavior.DataContractResolver =
GenericResolver.Merge(oldResolver,newResolver);
}
}
}
Figure 9 Implementing GenericResolverInstaller
GenericResolver offers two
constructors.
Untitled-3 1 12/7/10 3:45 PM
msdn magazine 52
DYNAMI C DATA
Pattern Matching
Database Records with F#
The data used by your applications doesnt just appear
out of thin air. To end up with a database full of useful data, youre
going to have to jump through a few hoops. To start, you probably
perform an extract, transform and load (ETL) process on some
collection of dimensional data. Tis typically includes cleansing,
pruning and standardizing the data. Tis is just to get the data into
a form that works in your database.
Afer the ETL step, youll want to go through your records and
make sure theyre useful and consistent. This typically means
implementing a matching and deduplication process. Next, youll
do some name and address parsing. With this information you can
begin a matching process and start identifying duplicates.
Tere are four common matching algorithms used for attribute
deduplication processes: absolute match, partial match, Soundex
Ambar Ray
and lookup match. Tese algorithms can be run against the data
and, once the percentage match score is computed, you can decide
whether to discard or store the data.
As an exercise, Ive implemented these four matching algorithms
using F# pattern matching and asynchronous programming fea-
tures to quickly calculate the aggregate match score. In this article,
Ill show you my implementation of the matching algorithms and
how I create the aggregate match score. Te ultimate objective of
this article is to showcase some of the features of F# such as func-
tional programming, imperative programming and implicit type
inference system, and demonstrate how you can use F# for accom-
plishing some signifcant data management tasks quickly and easily.
Preparing the Data
Ill start by loading the dimensional data from various transactional
systems in a staging table. The data source could be a relational
database, a fat fle, an Excel fle or an XML fle. Te ETL process
ofen uses a tool like SQL Server Integration Services (SSIS) 2008
for cleansing, pruning and standardizing the incoming data and
subsequently loading the staging tables. Te staging tables and the
master database are kept in a master data hub.
As mentioned earlier, I use a separate application built with F#
and Windows Presentation Foundation (WPF) to take care of the
matching and deduplication process. In actual projects, youd frst
generate ADO.NET Entity Framework models in the data-access
layer. Tese models model the master data tables along with all the
lookup tables present in the master data hub.
This article discusses:
Preparing data for matching
Matching and deduplication basics
The four matching patterns
Scoring the results
Technologies discussed:
F#, SQL Server
Code download available at:
code.msdn.microsoft.com/mag201102FSharp
53 February 2011 msdnmagazine.com
Next, the layer above should expose the underlying model
through Windows Communication Foundation (WCF) services.
Te business logic layer above would implement the matching and
deduplication routines as well as the parsing methods. Finally, the
presentation layer would present various GUIs to the data manager.
Figure 1 depicts the architecture of the application.
Im not going to demonstrate the entire application here, only
the implementation of the matching and parsing algorithms.
The subsequent sections will explain the implementation of the
matching and parsing algorithms in the business logic layer.
Getting Started
For the purposes of this scenario, lets assume that the row data
are retrieved from the database via the data-access layer and WCF
Data Services is subsequently stored in List<T> objects for further
processing. Tese List<T> objects will be populated with test data
for implementing the pertinent algorithms.
The master database contains all the source tables as well as
staging and history tables. As an example, Figure 2 shows the
composition of a Customer data entity.
Te matching algorithm can be explained by means of the fow-
chart in Figure 3.
Step 1 is not really part of the matching process, but rather a
precursor. Data is cleansed and standardized to a preferred format
before its sent for parsing.
Name Parsing
Te parsing process in Step 2 is also a precursor to the matching
process. In this step, individual names are parsed out of the data.
Assuming that a salutation may be entered along with the first
name, it should be broken down (parsed) into individual elements:
salutation and frst name. Tus, if Mr. John is provided in the frst
name feld, with Mr. being the salutation and John being the actual
frst name, then the algorithm will work as follows:
1. Pick the frst word terminated with a space (position A) as W1.
2. Identify whether W1 is a salutation by matching with a
lookup list. If so, ignore the salutation and proceed to step 4.
3. If W1 is not a salutation, consider it the frst name. Do not
consider the string snippet for further parsing.
4. If W1 is identified as a Salutation, identify the next
occurrence of a space or an end of string (Position B).
Consider the word enclosed within position A and posi-
tion B as First Name. Do not consider the string snippet
for further parsing.
For example, the string Mr. John would be parsed as shown
in Figure 4.
Position 1 to position 3 would constitute the salutation. Salutation is
optional, and would be populated only if the frst word matches with
an exhaustive list of possible values. (I do make an assumption here
that each part of the name, including salutation, has to be followed
by a space. An exception is made for the last name feld.) In Figure 4,
position 5 to position 8 would constitute the frst name.
Te implementation of this parsing algorithm in F# looks like this:
let ParseName(strName : string)=
let input = strName.Trim()
let splitNames = input.Split([|" "|], StringSplitOptions.None)
match splitNames.[0] with
| "Mr" | "Mr." | "Mrs" | "Mrs." | "Dr" | "Dr." | "Kum" | "Kum."
-> splitNames.[1]
| _-> splitNames.[0]
In this code Ive done pattern matching using the match and
with keywords of F#, followed by pattern matching rules, each
followed by the -> symbol.
Address Parsing
Te next step is address line parsing. Address lines 1 and 2 (concat-
enated) should be broken down (parsed) into a house or building
number, street name, street type, apartment type (optional,
constituting Apt, Flat or Suite) and apartment number (optional).
If city, state and country information are provided in address lines
1 and 2, then those need to be omitted.
A combined address should be parsed into a house number,
street name, street type and, if applicable, an apartment type and
apartment number. To illustrate, lets look at an example:
421, East Drachman St, Suite 5A, Tucson, Arizona, beside McDonalds
In this case the address elements are parsed as shown in Figure 5.
CUSTFIRSTNAME
CUSTLASTNAME
CUSTHOUSENO
CUSTSTREETNAME
CUSTSTREETTYPE
CUSTCITY
CUSTSTATE
CUSTPOSTCODE
CUSTMOBILE
CUSTCOUNTRY
CUSTID
CUSTACTIVEFLAG
Figure 2 Customer Entity
Figure 1 Master Data Management Application Architecture
Master Data Management Desktop Application for Data Stewards
Business Logic Layer (Matching and Parsing Algorithms)
Master
Data Hub
ADO.NET Entity Framework
Service Layer (WCF Data Services)
F# WPF Application for MDM Users
Other
Appli-
cations
SSIS 2008
Data
Sources
msdn magazine 54 Dynamic Data
Note that city and state information are parsed separately as {city,
state, country, zip} = { Tucson, AZ, USA, 85705} and are omitted
from the address line.
Lets look at the steps needed to parse the address line:
1. Defne an exhaustive lookup for street type and apartment type.
2. Defne an exhaustive country or region-specifc lookup for
state. State lookup should be defned as such that AZ and
Arizona are identifed as the same (but incorrect spelling
is not considered).
3. Concatenate Address 1 and Address 2 into a single address Line.
4. Search the address line string from the right-hand side
for valid city, state name or ZIP code with respect to
corresponding lookups. If true, then proceed to Step 5;
otherwise proceed to Step 6.
5. Remove city, state or ZIP code information if found in the
address line string.
6. Identify street and apartment tokens using the structure
Street {[Number] [Name] [Type]}, Apartment {[Type]
[Number]}. Token identification is based on searching
[Type] with respect to values in street type and apartment
type lookup, respectively.
7. Consider any remaining string
snippet afer Step 6 to be part of a
location descriptor.
Te implementation of this algorithm is
shown in Figure 6. In this code Ive used
while loops to scan through the state, city
and ZIP lookup tables for fnding a match.
Te main function ParseAddress uses this
to eliminate city, state and ZIP information
from the address line.
Matching and Deduplication
The process of matching and deduplica-
tion in Step 3 (see Figure 3) starts with the
identification of the following three types
of attributes:
Identity attributes, including Cust_
ID, name (First_Name, Last_Name),
address (House_no., Street_Name, City,
State, Zip_Code, Country), Mob_Phone
and so on.
Discriminating attributes such as date
of birth (DOB).
Record-qualifying attributes such as
country, region or postcode.
The application will prompt the user to
select these attributes. At least one each of
identity, discriminating and record-qualify-
ing attributes need to be selected. Note that if
any records are fagged due to inconsistencies
or errors in the identity and discriminating
attributes in the cleansing and standardiza-
tion process, these records should not be
considered for matching purposes.
As mentioned previously, matching will be performed based on
four routines: absolute match, partial match, Soundex and lookup
match. Te program would prompt the user to select which routines
will be used for each attribute. At least one routine should be selected
for each attribute, though all four can be selected for an attribute.
Appropriate weights need to be assigned to each identity attri-
bute depending on their importance to the business processfor
example, identifying a customer (Step 4). Similarly, weights need to
be assigned to each routine for each attribute. Te program should
prompt the user to defne the weights on a scale of 1 to 5.
Finally, we get to Step 5 and start to perform matching based
on discriminating attributes to obtain the match windows. Tus,
if DOB is defned as the discriminating attribute, then separate
windows need to be formed based on the DOB. Tis means that
records within the same window would have the same value of
DOB. In the subsequent steps, the matching process will be per-
formed within the individual windows and not within records
across diferent windows.
Absolute Match
In Step 6 I perform an absolute match for all attributes. Tis routine
compares two felds and looks for an exact
match only. A score of 100 is assigned for an
exact match. Any other result is scored 0.
For example, if Field 1 contains John
and Field 2 contains John, its an exact
Figure 3 The Matching Process
1 2
3
4
5
6a
6b
6c
6d
7
8 9
All the matching
processes take place
within individual match
Cleansing, Standardization
and so on
Match based on
Discriminating attribute(s)
to define the
match windows
Assign weights
to Identity Attributes
and Match Routine
(scale of 1-5)
Soundex Match for
First Name, Last Name,
Street name, Street Type,
City, State, Country
individually
Multiply aggregate
match scores in Step 8
for each attribute with
attribute weights. Sum
up the results to obtain
aggregate match score
for the records and
express in percent
For each attribute,
multiply match routine
result with each match
routine weight. Sum up
the results to have
aggregate match score
for each attribute and
express in percent
a) Identify Identity and
Discriminating attributes
Absolute Match
for all attributes
Partial Match
for all attributes
LookUp Match
for Street Type
Obtain match routine
results for each attribute
Name and
Address Parsing
Name M r . J o h n
Position 1 2 3 4 5 6 7 8
Figure 4 Name-Parsing Example
55 February 2011 msdnmagazine.com
match and is given a score of 100. If Field 1 contains Lisa and Field
2 contains Laura, its not an exact match and is given a score of 0.
Te implementation of this absolute match algorithm is:
let AbsoluteMatch (attrOfFirstRec : string) (attrOfSecondRec : string) =
let attrRec01 = attrOfFirstRec.Trim().ToLower()
let attrRec02 = attrOfSecondRec.Trim().ToLower()
match attrRec01, attrRec02 with
| "", "" -> 100
| _, _ -> if attrRec01 = attrRec02 then 100 else 0
Partial Match
Next, I can perform a partial match routine for all attributes. Te
partial match is used to determine the relationship to a blank value.
Tis is useful when some records have, for example, the customer
frst name but not the customer last name, or vice versa. Sometimes
a feld is blank in both records. Te partial match algorithm takes
care of matching those records where one of the important felds
might have been lef blank.
Blanks and zeros are considered to be the same value. As for the
absolute match, an exact match is scored 100. A blank feld value
versus a non-blank feld value is scored 75, while a blank feld value
versus a blank feld value is scored 65. Any other result is scored 0.
Te implementation of the partial match algorithm is:
let PartialMatch (attrOfFirstRec : string) (attrOfSecondRec : string) =
let attrRec01 = attrOfFirstRec.Trim().ToLower()
let attrRec02 = attrOfSecondRec.Trim().ToLower()
match attrRec01, attrRec02 with
| "", "" -> 65
| _, "" | "", _-> 75
| _, _ -> if attrRec01 = attrRec02 then 100 else 0
Notice that this code is similar to the absolute match.
Soundex Match
Now I perform the Soundex algorithm for the attributes first
name, last name, street name, city, state and country individually.
Te Soundex algorithm detects similar-sounding words using the
following algorithm:
1. Capitalize all letters in the string.
2. Retain the frst letter of the string.
3. Afer the frst position, convert all occurrences of the
following letters to blank: A, E, I, O, U, W, Y.
4. Change letters from the predetermined sets to correspond-
ing number as shown in Figure 7.
5. Remove all consecutive pairs of duplicate digits and blanks
from the string that resulted afer Step 4.
6. Return the frst four characters of the string, padded with
trailing zeros if needed.
Scoring values for the Soundex routine are a bit diferent. As
before, if both strings are equal theyre scored 100. If one string is
blank and the other is non-blank, then theyre scored 50. If both
strings are blank theyre scored 0. And if neither string is blank and
theyre not equal, theyre scored 0.
Te implementation of this algorithm in F# is shown in Figure 8.
In this code the Soundex conversion is done using pattern
matching, keeping the frst character intact. Te following two for
loops fnd consecutive duplicate characters and replace the second
such character with a blank. The next two for loops discard the
blanks, efectively removing any duplicates. Tus the four for loops
discard juxtaposed duplicate characters.
Te following two if statements extract the frst four characters and,
if needed, pad with zeros to make it at least four characters. Te fnal
pattern matching implements the scoring for the Soundex routine.
Lookup Matching
Lastly, I perform a lookup match for the street type attribute. A street
lookup table will be referenced to standardize the street type, like so:
let LookupMatch (streetName : string) =
let mutable streetMatchFound = false
let mutable i = 0
while ((no streetMatchFound) && (i < streetNames.Length)) do
if (streetName = streetNames.[i]) then
streetMatchFound <- true
match streetMatchFound with
| true -> 100
| false -> 0
let MatchCityStateZip (addressPart : string) =
// Match with a state
let stateMatchFound = stateNameTable |>
List.exists (fun (part1,part2) ->
part1 = addressPart || part2 = addressPart)
// Match with a city
let cityMatchFound = cities |> List.exists (fun city ->
city = addressPart)
// Match with a ZIP code
let zipMatchFound = zipCodes |> List.exists (fun zipCode ->
zipCode = addressPart)
stateMatchFound || cityMatchFound || zipMatchFound
// The main parsing address algorithm is as follows:
let ParseAddress (strAddress : string) =
let mutable finalAddress = strAddress
// Split the address
let addressParts = strAddress.Split([|","|],
StringSplitOptions.None)
// Remove city, state and ZIP information from the address
for i = 0 to addressParts.Length - 1 do
let currPart = addressParts.[i].Trim()
if MatchCityStateZip currPart then
// Index of current address part in original string
let currIndex = finalAddress.IndexOf currPart
// Remove city, state, ZIP information along with the
// following whitespace or comma
finalAddress <- finalAddress.Remove(currIndex, currPart.Length)
let finalAddress = finalAddress.Replace(", ,",",")
let finalAddress = finalAddress.TrimEnd([|','; ' '|])
finalAddress
Figure 6 Parsing Address Lines
Letter Corresponding Number
B, F, P, V 1
C, G, J, K, Q, S, X, Z 2
D, T 3
L 4
M, N 5
R 6
Figure 7 Soundex Letter Conversion
House No. Street Name Street Type Street Type Apartment Number Location Descriptor
421 East Drachman Street Suite 5A beside McDonalds
Figure 5 Address-Parsing Example
msdn magazine 56 Dynamic Data
Tis code scans through the street lookup table to fnd a street
name match using a while loop and then returns the scores if a
match is found.
Scoring the Results
In Step 7 of the matching process, I retrieve the scores of the
matching processes for each attribute. Tus, for frst name, if there
is no match for the absolute match routine, but there is a match for
the Soundex routine, the match routine scores for frst name would
be 0 and 100, respectively.
In Step 8, the weighted match score for each attribute is determined,
giving the attribute a score from 1 to 5. For example, if the absolute
matching score of 0 is weighted as 5, and the Soundex score of 100
is weighted as 4, then the aggregate score for frst name would be:
[(0x5)+(100x4)]/(5+4) ~ 44%
Assuming that all the match algorithms are selected, the imple-
mentation of this weighted scoring is shown in Figure 9.
Tis code assumes that all three match routines are called for each
attribute (though not for the street attribute, for which the lookup
match should be performed). First, Func delegates are declared for
each match routine. Ten the delegates are invoked in an asynchro-
nous fashion using the BeginInvoke method. Afer waiting for the
tasks to complete via WaitHandle.WaitAll, the results are collected
using EndInvoke methods that take IAsyncResult parameters
returned during BeginInvoke calls. Finally, the aggregate match
score is returned as the last expression in the function.
In Step 9, the aggregate match scores of each attribute are mul-
tiplied by individual attribute weights, then added and expressed
as a percent match score between the two records (see Figure 10).
The Task.Factory.StartNew method from the Task Parallel
Library for F# is used to call the aggregate match score for each
pair of attributes of the two rows of data being compared, followed
by a for loop that calculates the cumulative result. Finally, the
percentage match score is returned.
Match thresholdsthe upper threshold and lower threshold for
scoresare user-defned. Te system will ask the user for defning
the upper and lower thresholds. A record match score above the
upper threshold is considered an automatic match, while a record
match score below the lower threshold is rejected and is considered
a new customer record. A score between and inclusive of these two
thresholds should be fagged for review.
With that, youve completed the record-matching and dedupli-
cation process. Obvious duplications can be deleted, and you can
pass on the records fagged for review to either a real human or a
more extensive programmatic review process.
AMBAR RAY is a solution architect working on Microsof technologies. Ray has
nearly 12 years of experience in the IT industry.
THANKS to the following technical experts for reviewing this article:
Don Syme, Technical Excellence Group of TechMahindra Ltd.
let WeightedAverage results =
let cumulativeWeight = results |>
Array.sumBy (fun (r, weight) -> r * weight)
let totalWeight = results |>
Array.sumBy (fun (r, weight) -> weight)
cumulativeWeight / totalWeight
// Aggregate match score
// Calling the match routine which in turn calls absolute match,
// Partial Match and Soundex Match routines in parallel
let FindAggregateMatchScore row =
let resultsWithWeights =
Async.Parallel [ async { return AbsoluteMatch row, 5 }
async { return PartialMatch row, 5 }
async { return SoundexMatch row, 4} ]
|> Async.RunSynchronously
WeightedAverage resultsWithWeights
Figure 9 Aggregated Scoring
// Percentage match score
let FindPercentageMatchScore(rows : seq<string * string>) =
let results =
Async.Parallel [ for row in rows ->
async { return FindAggregateMatchScore row } ]
|> Async.RunSynchronously
// Apply a weight of 5 for the first attribute and a weight
// of 4 for second and a weight of 3 for all other attributes
let resultsWithWeights = results |>
Array.mapi (fun i r ->
r, (match i with 0 -> 5 | 1 -> 4 | _ -> 3))
WeightedAverage resultsWithWeights
Figure 10 Weighted Scoring
let SoundexMatch (attr1:string, attr2:string) =
let conv c =
match c with
| 'A' | 'E' | 'I' | 'O' | 'U' | 'W' | 'Y' -> ' '
| 'B' | 'F' | 'P' | 'V' -> '1'
| 'C' | 'G' | 'J' | 'K' | 'Q' | 'S' | 'X' | 'Z' -> '2'
| 'D' | 'T' -> '3'
| 'L' -> '4'
| 'M' | 'N' -> '5'
| 'R' -> '6'
| _ -> c
let convertSoundex (inp:string) =
// Capitalize all letters in the string
let chars = inp.ToUpper().ToCharArray()
let chars =
[| // Retain the first letter of the string
yield chars.[0]
// Keep the first character, and remove pairwise-duplicates
// Change letters from the predetermined sets to
// corresponding number
for (c1,c2) in Seq.pairwise (Seq.map conv chars) do
// Remove all consecutive pairs of duplicate digits
// and blanks from the string
if c1 <> c2 && c2 <> ' ' then yield c2 |]
// Convert back to a string
String chars
// Retain first four characters of resultant strings padded
// with trailing zeros if needed; leave unchanged if any
// string is blank
let adjustResult (result:string) =
match result.Length with
| n when n >= 4 -> result.Substring(0, 4)
| 0 -> result
| n -> result + String.replicate (4 - n) "0"
let attr1Result = attr1 |> convertSoundex |> adjustResult
let attr2Result = attr2 |> convertSoundex |> adjustResult
match attr1Result, attr2Result with
| "", "" -> 0
| "", _ | _, "" -> 50
| _, _ -> if (attr1Result = attr2Result) then 100 else 0
Figure 8 Soundex Match
Untitled-1 1 1/13/11 9:48 AM
msdn magazine 58
BUSI NESS CONNECTI VI TY SERVI CES
Managing Employee
Rewards with Of ce and
SharePoint BCS
Ying Xiong
Managing employee rewards is a business-critical
function at all companies. Tis is especially true for large enterprises
such as Microsoft. At Microsoft, we offer many types of rewards
to eligible employees, such as merit-based pay increases, promo-
tions, bonuses, stock and other awards. Managing these rewards
according to company guidelines and budgets (set for each region,
business unit or organization, employee salary plan, and pay level)
is a complex process.
Many business rules are involved when giving rewards to employ-
ees. Among other goals, these rules ensure that our top performing
employees at all levels receive highest rewards while the organiza-
tions at all levels meet their goals and remain within their budgets
and guidelines. Every year, managers and HR personnel analyze
the numbers and determine each rewards guidelines and limits
at all levels. This process (called calibration) is time-consuming
and complicated.
The current rewards-management tool used by our managers
and HR personnel is a Windows Forms application. Te tool works
as designed, but it doesnt meet all of our needsthere are a num-
ber of ways it could be improved to simplify and streamline the
calibration process.
In response to suggestions for improving the calibration tools,
the Microsof IT (MSIT), HR Business and Microsof Of ce and
SharePoint product teams collaborated to create a new solution
based on Microsof Business Connectivity Services (BCS), a fea-
ture of Microsof Of ce 2010 and SharePoint 2010. BCS provides
read/write access to external data from line-of-business (LOB)
systems, Web services and databases, as well as SharePoint and
Of ce applications.
The new solution uses Microsoft Excel 2010 as the rewards-
management UI, and leverages BCS technology to cache and
synchronize employee data and business rules between the users
local machine and the back-end systems (Rewards Web Services
and a SQL Server database).
This article shares the experiences of the Microsoft teams in
developing and deploying the rewards-management BCS solution.
Where We Started
Te existing rewards-management tool was designed to support
an integrated performance management experience for overall
employee assessment, calibration, ratings and rewards through a
single cohesive toolset. Figure 1 shows the architectural design of
This article discusses:
BCS basics
Dening ECTs
Creating an Excel add-in
Using the BCS APIs
Technologies discussed:
Ofce 2010, SharePoint 2010, Business Connectivity Services
59 February 2011 msdnmagazine.com
the existing tool. Tis tool is a typical three-tier application where
the UI layer is a Windows Forms application that reads data from
and writes data to back-end Web services. Tese services query
and update employee records, business rules and other reference
data in a SQL Server database.
Te solution was designed to minimize network traf c between
users computers and Web servers hosting the Web services com-
ponent. When the client app starts, it retrieves and caches all nec-
essary reference data, business rule data and employee records in
the organization to which the user has access permissions. Most of
the rewards-management business logic and rules are implemented
in the client component. Hence, when the user assigns or changes
employee rewards, the corresponding business rules are fred to
validate the changes without calling Web services at the back end.
Te Web services component was built with the Microsof .NET
Framework 2.0 Web services framework (ASP.NET Web Services). As
mentioned earlier, it returns employee records and business rules
data to the client application and saves data changes passed from
clients to the database. Teres business validation logic in the Web
service to ensure data integrality before the data is saved to the data-
base. All Web services calls are designed as synchronous methods.
Users get error messages when Web services calls fail, and users
can take action based on the nature of the error. In addition, the
Web service was designed to serialize employee and other data
records into a byte array and return the byte array to clients in order
to minimize the size of data transferred between Web services
servers and the client app.
Finally, the rewards data was stored in a relational database
implemented in Microsof SQL Server 2005. Tis database stores all
data needed for managing employee rewards, as well as historical
data for past performance-review periods.
As I mentioned previously, this application architecture worked
largely as planned and was a signifcant improvement over previous
rewards and calibration systems. However, in use, we discovered
many areas where we could improve the tool to make calibration
easier and less time-consuming. So that youll understand the
reasoning behind design decisions for the new service, lets take a
quick look at some of the issues discovered in the old one.
Te frst, and probably most important, issue encountered in the
old calibration tool involved the dif culty of modeling rewards.
During the calibration process, managers need to balance two
variables. Each employee must receive appropriate rewards based
on a performance rating. However, the entire organization needs
to meet a predefined rewards budget. Getting this balance right
is a time-consuming process. Managers need to enter employee
rewards numbers, see how they afect the team rewards budget, and
adjust rewards to balance both reward rules and budget. Tis can
take multiple iterations before the rewards are fnalized.
The existing tool didnt facilitate the rewards-versus-budget-
balancing process. It didnt provide capabilities for managers to
enter diferent numbers for each reward and analyze the result to
see the impact to the budgets and guidelines. Instead, managers
ofen had to export the employee data into an Excel spreadsheet
and manually model rewards and budget fgures.
When calibration is complete and each employees rewards are
fnalized, managers have to enter the data into the tool manually
and submit the rewards for approval. Tis double data entry is also
a time-consuming process.
Te Windows Forms-based tool requires users to be online and
on the corporate network because the tool needs access to back-end
Web services for data reads and writes. Tis adds another level of
hassle for employees with busy schedules or who travel frequently.
Finally, while the existing rewards-management tool provided a
built-in set of reports, we had many requests for additional reports
and fexible ad hoc reporting capabilities to make the calibration
process more transparent and ef cient.
BCS Basics
BCS lets you use Of ce applications (Excel, Outlook, InfoPath, Word
and so on) and SharePoint to process data from back-end systems.
As I already mentioned, BCS is a component for both Of ce 2010
and SharePoint 2010, so its available on both client and server
machines. (See msdn.microsoft.com/library/ee556826 for more information
about the BCS tooling and runtime components.)
When designing a BCS-enabled solution, you start by defning
an entity model that can connect to external systems and map data
from those external data structures into the BCS data structure.
Tis entity model is called an External Content Type (ECT). You
can create as many ECTs as you want for your solution through
SharePoint Designer or Visual Studio.
Figure 1 Architecture of Current Rewards-Management Tool
Databases
Employee
Rewards
Databases
Employee
Profile
Databases
Payroll
Databases
Client Windows Forms Application
Web Server Rewards Web Services User Security Web Services
Most of the rewards-
management business logic
and rules are implemented in
the client component.
msdn magazine 60 Business Connectivity Services
ECT metadata, including the code for defining the entity
model, is published and stored in a SharePoint metadata store.
The published ECT model can be downloaded and installed on
user client machines through a SharePoint workspace or via a
standalone packaging tool provided by BCS.
At run time, the BCS runtime component on either the client
or on the server invokes the ECT model to communicate with
external systems. On the client, the data from any external systems
is cached on the users machine in a SQL Server Compact Edition
(SQL CE) database. Te cached data can then be displayed and
manipulated in Of ce applications through the BCS APIs. Te
changes made to the cached data by users will be queued on users
machines in the same SQL CE database. Te BCS runtime com-
ponent is then responsible for updating the changes to external
systems through the ECT model.
The New Rewards Tool
For the new rewards-management tool, we created a solution using
the BCS framework, with Excel as the rewards-management UI,
to address business issues described earlier. In this Excel/BCS
solution, we defned a total of 15 ECTs for employee information,
business rules and other reference data. The BCS runtime uses
these ECTs to connect to existing rewards-management Web ser-
vices (as external systems) and to retrieve and cache employee and
business rules data.
Te employee data is rendered as an Excel worksheet through an
Excel add-in that uses BCS local cache APIs. Managers can assign,
calibrate and manage their employee rewards completely within
Excel and still be able to enforce all business rules based on rule
data cached in the BCS local storeeven if the managers are
of ine. With the Excel and BCS solution, managers are able to see
a list of selected employees (in the Excel worksheet) and various
statistics (in the Excel Task panel) on one screen. Te statistics at
the bottom are dynamically updated as reward values change, and
diferent statistics are displayed depending on the feld selected by
the user. Tis is a greatly improved user experience.
Using native Excel functionality, such as pivot tables and charts,
managers and HR personnel can create and visualize various
reports for the data cached by BCS, thus improving productivity.
Trough Excel templates, users can create reports more easily, and
the reports dont require IT development.
Aside from business benefts, an interesting technical point we
discovered while developing this new rewards-management solu-
tion was that we could leverage the existing Rewards Web Services
component in the BCS solution even though the Web services
werent designed or optimized for BCS. We were also able to lever-
age existing business rule data objects and validation code within
our Excel add-in solution. As a result, we are able to deliver and
demo the new solution in a relatively short period of time.
Solution Architecture
Te new solution architecture is shown in Figure 2. As you can
see, the changes to the original architecture were made only for the
client architectural component. In the diagram, the green boxes
are BCS components that are already installed on users machines
when they install Of ce 2010. Te blue boxes are the components
developed for the new solution, and the light-blue boxes are
components of the existing rewards-management tool.
When the ECTs developed for the new rewards solution are
installed on a user machine, the BCS sync process (BCSSync.exe)
immediately invokes the entity model to retrieve data for each ECT
defned in the model from the external rewards Web services. Te
actual data synced is determined based on the users data-access
permissions (obtained via user security Web services). Tis step
requires that the user be online in order to access Web services.
Retrieved data such as employee records for an organization is
stored in a SQL CE database created by the BCS sync process as
the local data cache for the user. Te data in SQL CE is encrypted
using the users certifcate and the data is secure at the user level.
The BCS sync process runs periodically to synchronize the
users local cache with the rewards server for any changes made
on the server side. The BCS framework enables the ability to
defne synchronization frequency for each ECT diferently. Tis
Figure 2. Architecture of the New Rewards Solution
Databases
Employee
Rewards
Databases
Employee
Profile
Databases
Payroll
Databases
Client
BCS Local Cache
(SQL CE Database)
BCS Sync Process
(Reads and Writes)
Web Server
Rewards BCS
Entity Model (ECTs)
Rewards Web Services User Security Web Services
Microsoft Office Excel 2010
Rewards Excel Add-in
BCS Offline APIs
New Solution
Component
Microsoft BCS
Component
Existing Rewards
Tool Component
BCS lets you use Ofce
applications and SharePoint
to process data from
back-end systems.
61 February 2011 msdnmagazine.com
means we can defne a longer (hours or days) sync frequency for
infrequently changed entities such as business rules, and shorter
(minutes or hours) sync frequency for employee rewards data
that can change frequently during the review period.
With employee, business rules and other reference data cached
on the users machine, the user can start the rewards-management
tool by simply launching Excel. Te rewards Excel add-in uses
BCS APIs to retrieve data from the SQL CE database and binds
the data into an Excel worksheet. From that point the user can see
the employee records and their rewards data in Excel. Tis Excel
fle is no diferent than other Excel fles you normally create or use,
and the user can employ native Excel functions to manipulate and
analyze the data.
When the user makes changes in the worksheet to assign or
update employee rewards such as salary merit increase percentage,
promotion amount or stock award shares, corresponding business
rules are fred to validate and process these changes. Were able to
achieve this by hooking the value change event of an Excel cell to
existing business rule code.
Moreover, some employee data such as employee number, job
title and e-mail address cant be changed by users. We accomplish
this requirement by using a native Excel lock feature.
When the user is ready (online or of ine) to submit changes to
the back-end server, the changes are submitted into a local queue
stored in the SQL CE database. Te BCS sync process picks up
changes one at a time from the queue and sends the changes to the
back-end Rewards Web Services. If the user is of ine or the back-
end Web services are not available, the BCS process will retry the
change until the user is online or the Web services are available.
If the user isnt ready to submit the changes to the back-end server
and wants to save changes as a draf, this is handled as a normal
Excel fle save operation.
Dening ECTs
As stated previously, an important frst step for any BCS-enabled
project is to create the ECTs for your solution. Designing ECTs is
the process of modeling the data entities youll use in your Of ce
or SharePoint solution. Te number of ECTs and the data structure
for each ECT depends on the nature of your application data, how
the data is used in your application and the interfaces provided by
your external systems.
Because the data for ECT entities come from external systems
(the Rewards Web Services, in our case), the simplest way to model
your entities is to design them the same as the returned types
from your external systems. Tis involves no data mapping from
one structure to another structure. However, you cant always do
this, especially when external Web services return data types that
are complex and have a deep hierarchy. Tis was the case for the
rewards-management system.
Te existing Rewards Web Services return a serialized byte array
(for employee and business rule data) that needs to be deserialized
on the client side into custom System.Data.DataTable types. Tese
custom data types arent supported by default in BCS.
Our ECT implementation for the new rewards system defnes a
relatively fat data structure (with simple data types) for employee
and business rule entities. It also converts or maps the data from
the custom data tables (afer deserialization) into the fat ECT
structure. When users update data through ECTs, we then con-
vert data back to custom data table types and send the changes to
the back-end Web services.
Every ECT must have at least two methods defned. Te Finder
method is invoked by the BCS runtime to download all data. In
the case of the employee ECT, it returns all employee records the
user has permission to access. When an ECT is installed on a client
machine, the installation process will create a subscription
based on the Finder method for the BCS runtime to periodically
synchronize the ECT.
Figure 3 ECT Deployment Process Through
SharePoint Workspace
1 2
Publish ECTs Create External Lists
3 Download and Sync
External Lists
4
Install External
Lists and Corresponding
ECTs
SharePoint Server 2010
User Laptop Computer
Visual Studio 2010 SharePoint Home SharePoint
Metadata Store
SharePoint Workspace 2010
BCS Data
Cache and
Metadata Store
Figure 4 ECT Deployment Process Through BCS Solution
Packaging Tool
1
2
Publish ECTs
Export BCS
Model
3 Generate VSTO Click
Once Installation
SharePoint Server 2010
Visual Studio 2010
BCS Model Files
(.bdcm)
SharePoint Designer
BCS Solution Packaging Tool
SharePoint
Metadata Store
User Laptop Computer
BCS Data
Cache and
Metadata Store
VSTO Installation
Files (setup.exe)
4 Run Setup.exe Which Installs ECTs
and Downloads EDT Data
Directly from External Systems
msdn magazine 62 Business Connectivity Services
The SpecificFinder method returns the specific instance of
data (employee) based on the entity identifer (employee number).
SpecificFinder is used by the BCS runtime to synchronize the
employee instance with the back-end server. For data entities
that users update on the client side, such as employee records, the
ECTs include an update method that the BCS runtime can invoke
to send updates to the server. Similarly, if users need to create new
records of an entity, a create method is defned in the ECT. Refer-
ence data entities that users wont change dont need the update or
create methods for their ECTs.
In your own ECT implementations, you can add any business
logic you need to validate or process data before invoking exter-
nal Web services. Tis is a great design option with BCS that lets
you put business logic right in your ECTs and run it on both the
client and the server.
There are two ways you can design and create ECTs. If your
external systems return relatively fat and strongly typed data types,
you can use SharePoint Designer to generate your ECTs. SharePoint
Designer generates ECTs based on external system interfaces
operation and data contracts in the case of Windows Commu-
nication Foundation (WCF) Web services. However, at this time,
SharePoint Designer doesnt support complex and custom types
such as custom data sets and data tables.
Te second and more powerful approach is to use Visual Studio
to design and create ECTs. Visual Studio 2010 includes a project
template specifically for creating BCS entity models. This is the
approach we used in our rewards solution.
ECT Deployment and Installation
To make the rewards-management system work, the ECT models
need to be downloaded and installed on the client machine.
Microsof Of ce and SharePoint 2010 provide two ways for deploy-
ing ECTs. Figure 3 shows a deployment process using SharePoint
Workspace, which is installed on
users computers as part of the
Of ce 2010 installation. Figure 4
illustrates how it works.
First, ECTs are published from
Visual Studio to the SharePoint
Server metadata store (step 1). For
Visual Studio to publish ECT meta-
data into the SharePoint data store,
it must run on the same server
where SharePoint 2010 is installed.
Next, you create an external
list for each published ECT (step
2). You can create the external list
through the SharePoint homepage
from any computer that can con-
nect to SharePoint Server.
Afer you create the external list
for an ECT, SharePoint immedi-
ately runs the ECT, which connects
to and retrieves data from the
external systems and displays the
data as list content on the SharePoint site. With this deployment
process, you can view the data returned from your ECT on the
SharePoint Server, in addition to your office application on the
client. In some situations this is a desirable feature, but its not
required. The rewards-management solution doesnt use this
feature because we dont want sensitive employee-rewards data to
be shown through SharePoint.
Now download the external lists created from SharePoint Server
in step 2 to your local machine (step 3). You can start the down-
loading process by connecting to the SharePoint homepage from
Internet Explorer and selecting Site Actions | Sync to SharePoint
Workspace. Tis will launch the SharePoint Workspace program on
your client machine and start downloading external lists one at a
time. With the current release of Workspace 2010, the user will have
to click the Install button for each external list to be downloaded.
By downloading an external list, SharePoint Workspace will
automatically install the ECT (metadata and assembly) into the
BCS local data store (step 4). In addition, a subscription is created
for the installed ECT for BCS runtime to synchronize ECT data
periodically with the external systems. The default data sync
frequency is six hours.
Te rewards-management solution uses a second deployment pro-
cess to install ECTs onto users client machines (as shown in Figure 4).
In this deployment method we use the BCS Solution Packag-
ing Tool (code.msdn.microsoft.com/odcsps14bcspkgtool) and there are no
Figure 5 Excel Design for the Rewards-Management Solution
An important rst step for any
BCS-enabled project is to create
the ECTs for your solution.
ement1); areaSeries Add(seriesElement2); areaSeries Add(seriesElement3); // Add series to the plot area plotArea Series Add(areaSeries); //page Elements Add( new LayoutGrid() ); // Add the page elements to the page AddEA ement1); areaSerie ies.AAdd(se (s rriesElement2 t2); a ) reaSeries.Ad A d(seriesElement3); // Add series to the plot area plotArea.Series.Add(areaSeries); //page.Elemen em ts.Add( ddd( new ne La LayyoutGrid() ); // A / dd the page elements to the page AddEA
s, 240, 0); AddEAN1 AN 3Sup Sup5(pa 5(p ge.Elemeent nts, 480, 0); AdddUPCVersionA(page.Elemen e ts, 0, 135); AddUPCVersionASup2(page.Elements, 240, 135); Ad ddUPC ddUPC d CVers sionA ionA o Sup5((page.Elemennts, t 480, 135); AddEAN8(page.Elements, 0,
.Elements, 480, 2 270); ; Add ddUUPCVersionE(pa page.Elementts, 0, 405); AddUPCVersionESu E p2(page.Elements, 240, 405); AddUPCVersionESup5(page age.Ele .Ele lemmments, 4 s, 4880 0, 4405); // A Add the page to e t the document document.Pages.Add(pa
CaptionAndRectang a lee(eleme ements, EAN/JA /JAN 13 Bar Codde, x, y, 204, 99); BarCode barCode = new Ean13(123456789012, x, y + 21); barCode. ode.X += X + X += X + ((20 04 - 4 - baarCoode.GettSymbolWidth() h ) / 2; elements.Add(barCode); } private vo vo
dRectangle(element e s,, EAN EAN/JAN 13 Bar C ar Code, 2 digit supplement, x, y, 204, 99); BarCode barCode = new Ean13Sup2(1 2 234556789 678 012 1212, 2, x, yy + 2 + 211); 1); barCoode.XX += (204 - barCode.GetSymbolWidth()) / 2; elements.Add( (barC
ts, oat x, oat y y) { A { AddCa CaptionAndRectan angle(elements, EAN/JAN 13 Bar Code, 5 5 digit supplement, x, y, 204, 99); Ba B rrCodee barrCode == new Ean13Sup S 5(12345678901212345, x, y + 21); ba
s.Add(barCode); } } pprivate te vooid AddUPCV PCVersi ers onA(Group elements, oat x, oat y) {Add { CaptionAndRectangle(elements, , UPC Vers Vers Vers Version ion o i A Baar C r Coode, x, y, y, 204, 99); ; BarCo ode barCode = new UpcVersionA(12345678901, x x, y +
s.Add(barCode); } } pprivate te vooid AddUPCV PCVersi ers onASup2(Group elements, oat x, oat o y) { AddCaptionAndRectangle(element m UPCC Version E Bar Code, 2 digit supplement, x, y, 204, 9 4 9); BarCoode od
21) ; barCode.X + += (2 = ( 04 - bar ba Code.GeetSymb ymbolWidth()) / 2; elements.Add(barCode); e } private void AddUPCVersionASSSSuup5( up5( u Group elements, n oat x, oa o t VV
digit supplement, t xx, y, 22004, 99); BarCode Code b barCode = new U UpcVe p rsionASu AS p5(1234 3 567890112345, x, y + 21); bbarC arCode.X de.X += (204 - barCode.GetSymbo o m lWidth()) / 22; e ele le
t x, oat y) { AddCap dCaptionnAndR And ectangle(ele elemments, EAN/JAN N 88 Bar Code, de, x x, y, 204, 0 99); BarCode barCode = n new E ew Ean8( an8( n8 n8 1 2345670, x, y + 21); OpenFile ileDial a og leDi e aloog og lo =
g.Filter = Adobe ob PD PDF leess (*.pdf)|*.pdf|Alll File Files (*.*)|*.*; if (leDi eD alog.SShowDi ialog() == DialogResult.OK) { { pdfV pdfV f iewe ewer.Op Op r.Op Open (leDialog alog.Fil leName, ); } Save veFileDialog saveF aveFile ileD Dialoog = ne neww Sav
Dialog.Filter = = Ado Adobe PPDF DF les (*.pdff)|*.pd pdf|A |All Files (*.*)|*.*; ; iff (saveF FileDialo log.Show h Dialog() ==Dialo alogRes gRes Re e ult..OK) OK) OK) { pdfV fVView .SSaveAs ve (sav (saveFi eFileDia
printer = pdfView Viewer.P er rinterr; pprinter.Pri intWi WthDialog(); } elsee { MesssageBox.SShoww(Please ope open a n a le to p to print rin rint) ); }OpenFi n le DDialoog leDi eD alog alog = new OpenFileDDialog(); leDia Dialog. og Tittle = e e = e Ope pen File D l
les (*.*)|*.*|Ad dobe P e PDF les es (*.p *.pdf)|*.pd ddf; if i (leDialog.ShowwDial alog() === DialogResult. ult OK) { { Dyna DynamicPDFV DFV DFV DFView iew ewerClass test e = neew DynammiccPDFViewerClass((); PPDFPrinter ter pprin p ter er r = te = tte t st.OpenFFileFo
= File.ReadAAllByte Bytes(@C:\M :\MyD yDoc.pdff); //u // sing System.Run ntimme.Int te nt ropServicces;GCHa GCHandle ndle dd gch=GCH = CHaan and dl a e.Aloc(conte ents, GCHandleT Typee.Pinnedd); ) IInt ntPtr Ptr co on contentsIntPtr = g
tents.Length h, ); ); AAddCa CaptioonAndRe Re ectangl an ee(pageElementts, B BBookkmar k k Pagee EEleme lemeent: nt:, x, , y);; pa pag aa pageE eEleemeents.Add(newtes w t Bookm ookmaark(Bookmarked Text Textt, x + 5 5, y , y , y y ++ 2 + 20 + , pa p rent re Outl O ine)); p ) a
215, 10, Fonnt.TTime mesRoman ma , 10 10)); } pr prrriivate vooid AddCiircle rcle(GGro (G up paageEleme ennnts, nts oa oat x, x oa oat y t y) t y) { / { /////Add /Add /A ss a circlt to the pa p ge Ele emen ment en ents AddCap dCap Ca Ca dCaption t AndR dRecta e
Add(new Cirrcle(x e(x ++ 112.5f 5f, y ++ 50f, 1007.5f, 300f, RgbColo olor.R RRed, RgbbbColor.B or.Bluee, lue 2, Line L eSty yl yll y e.Da Da e shLa L s rge))); } pprivate void Ad A d FormatteeddTexxtAreea(Groupp paageElements, o aat x, oat yy)) { ) // A // AAdds dds a fo fo a rmatted text te a
mic</i><b>PDF PDF</b> /b>&tm; G Generator vvv666.0 6 for ..NET NET has has a forrmattted tte text ar rea p ea paaage a + ele ele ele eeemmment m . Th This prroviddes rich for orm m atting ssupp upport for tex ext that app ap eears in the doocumment. You have + + comp complet lete con co trol ol ove ove ve ver 8 r paragraph
left indentattionn, rig righht inden entation, alig liggnnment, allo llowing orphaaan linnes, aand wh white ite + spa spaace ce pp ce ppre reservat a ion; 6 foont prop ropeerties: e <fon ont fa t f ce= =Time mes> s>font face ce, </ /font t><font ppoin ntSize=6>font + s + size, </font> ont><fon ont co coo coo t lor= lor=FF0000 00>c
2 line pr properties es: le leading, a g ndd leaddinngg type. ype. TText can also be rootateeed.</ d.</ < p>; p> FFor or o matt matt mm ed eedTe edTe Te extAr x ea fforma ormattedTTextAre Area = n new FormattedText Tex Area re (formatt at edH Html l, x + 5, yy + 20, 215, 60, FonttFammily.Helve elvetic tica, 9, fffal alsse); se); se); sssse) // // Sets the i
ddCaptionA AndRe Rectan ct gle( e(page pageElemeennts nts, F , For orrma rmatted tte Text T Are ea e Page El Elemen ement:, t:, ,, x, y); y); y) y AddC AdddC ddC A aptionAn AndReectang ngle le(pageElements, Format m tedTextA x rea Over Ov ow TText:, x x + 2279, y); pageElement ments.Add(foorma rmattedTTTextA xttAA tArea) r ; // Cr Cre r ate
tArea overowFo owFormat rm tedT dTextAArea == foorma matteddT d t extArea.GettOveerowwwFormat matteddT Tex extA xx rea( re rea( re x + x 28 284, y + y 200); pageElements.Add(overowFormattedTextAArea) ); } pprivate vooid AddImage(Group p pag pageElements ents, oat t x, o , at yy) { ) { // // A / dd
ents, Imagee Page Page Element en :, xx, y); IImmage mage imaaage = ge new Imaage(SServve ver.M r.MapPatt atth(. h(. ./I ./Im ./ ages ages/DPD DFLog L o..png), x + 112.5f, y + 50f, 0.24f); // Image is ssizzed and centeredd inn the rectangle immage. age SetBound unds(21 s(215, 5, 6 5 0); 0) image.VA VAAlign
ge); } privatte void oid AAddLabel a (Group p p p page ageElem emments, oat x, oat y) { /// A / Adds a s aa llabel t el tto th t e pa ppa p ge geElemen ementts AddCaptionAndRectangle(pageElemen m ts, Lab La el & PPageNummbeeringLabel Page E Elemments:, x, x, y); y) stri ing g laabelText xt == = Lab
aain page numb umberin ering: %%CP% %CP%%% of of %%%T %%TP%%% pages.; LLabel l e abbel = n new L LL ew Laabel(labbelTe elTee elTexxt, x + 5, y 5 ++ 12, 220, 80, Font.TimesRoman, 12, Tex e tAlign.C .Centter); label.Annglee = 8; PageNumbeeringgLabel page pageNumL NumLabel ab = nnnew ew P w Page
, 12, TeextAl xtAlig ign.Cent C er); pag a eEleement nt ntss.Ad .Addd(paageNumLabel)); ); ppaggeElemen ments.Addddd( d(label)); } } priv pr pp ate void oid AAddLine(Group pageElements, oat x, oa o t y) { /// Ad dds a a line to the the pageElements Ad ddCCaptionAndR AndRRectanngle gle n (pag pag ( a eeElemments
+ 5, + y ++ 20, x + 220, y + 80 80, , 3, R RgbbColor.Gr .G eeen)); pageElemme ments s. n Add( d( d new w Linee(x + + 22 220 0, y y ++ 20, x + 5, + 5, y + 80, 3, RgbColor.Green)); } private void AdddLLink((Grouup pageEElemments, oat x, oaat yy) { // Adds a ds a link to to the thhe pag p eEle Eleemen
yn ynamicPDF.com. m ; A AddCa ddCaptio ptionA Andd nAndRectangl an e( (pageElementts, LLink Pa Page ge Elemment: nt:, xx, y); y); LLabel llabel a = new Label(text, x + 5, y + 20, 215, 80, font, 12, 2 RggbCoolor.Blue) e); laabel.Underline = true; rue Link link = k = new new L Linnk(x k(x ++ 5, 5, yy ++ 20,
on( o httpp://www.dynnamicppddf.coom m))); pageE eElemments..Add( Ad labbeel); l); ppage pag pageElements nts.A Add(link); k) } pr p ivatee void AddPath(Group pageElements, oat x, oat y) { // AAdds a path to the pageElemeents ceeTe.Dynamic amic icPPD PDF.Page geElem lem lements.Pat P h
20, 0 Rgb gb bColor.Blue, RgbC RgbCoolor.R Redd, 22, LineSty eS lee.Solidd, true); pathhh.Su .SubbPaths.A .Adddd(new L w LineS ineSubPa ubPath(x + 215, y + 40)); path.SubPaths.Add(new CurveToS ToSubPPath h(x + 1 + 08, y + 80, x + 160,, y ++ 800)); path.Sub SubP SubPathssss h .A AAd .Add(new (ne CurveS
ect ecctangl angle(pageElemeents, P Path P h Paage ge Element:, x, yy); ) pageE Ele Ele EE meentss.Ad Add(pa d(path)); th } p priva ate v e vooid AAddRectangle(Group pageElements, oat x, oat y) or ordere de ddList = orde o redL edList.GetOverFlowL o List((xx + x 5, y + 2 + 22000); AddC ddCCC A apti ap a oonAndRect
2 22 2 55, 1110); page.Eleements.A ts.Add(o dd(ord rd rder r edList); x == 0; 0; y += y ++= y + 118 88 1 ; // CCCreaate e aan unorrdered e lis ist Un UnordderedList unorderedList = new Unor o deredList(x + 5, y + y + 220, 4400, 90 0, Font.H t.Helvetica, 10); uuunoorderredList st.Itte .I ms.A mms A m dd( ddd(Frui Fru FFFr Fru F ts s); unorder
er ee ies(); pieSeries.Da ataLab abel = da; plotArea.Seeries ess.AAd .Add(pieSSSeries ss); es p pieSeries.Eleme lementss.Add Add(27, 7, Website A); pieSeries.Elements.Add .Ad (19, Website e B)); pieSerries es.Element men s.Add(21, W Webssite C C); pieS pieSSerie eri riees.Elemen eem me e ts[0 s[0].Color = a
s ess.Elemments[2].Color = auttogradient3;unor o derre der ddSubLList2 = = uno orderedList.Items[ ms 1].SubL ubLissts.AAddUnorderedSubList(); unorderedSubL u ist2.Items.Add( dd(Pottato); un u ordeeredSubList2.Itemmms.A .Add( d(Beaans ans ea );;; UUUnor U dere re e dSub Su List subU
dSu edd bList(); subUno UnorderedSubList.Items.A s.AAdd( d Lime); subUUnord dere edSubList.Item tems.Ad s.Add(O d(Orang range); e Unorder d edSubList su s bUnorder d edSu e bList2 = unnord dereedSubLis Li t.Items[ ms 1].SubLists. s.AddU AAddU d nor rderedd eddSubL SubL bList( st ); ssubUn bUn u oorderedS e ub
na aa ); U Unordered eredSubList subUnord o ered edSubL Su ist3 st3 = uunnorderredSubL SubList2.Ite t ms[0 0].Su .SubLis Lists.A s.AddUn d orderedSSubList(); subUno U rderedSu dSubList3.Items.AAdd((Sw weet Pota o to)); U UnorderedS redSubL ubLi L st s st ubUUnord rdeeredS dS redS dSubList4 st4 st = un unorderedSu
ubL Su Su ist4 44.Ite .Items.A m dd(String Bean n); s ; subUn bUnordeere edSubbList4..Itemms.Ad dd(Lima Bean Bean); subU subUnnorderedSubList4.Items.Add(Kidney Bean e ); x += 279; pag page.EElemenntts.Addd(unorderedList st); u ); ; nord no ered reddLis st = = uunord n ered d reddLis st..Get G Over v Flo
e. e.Elemeents en , Unordered List Page E ge Elemment O n ver verow:, x, y,, 2255, 110); page.Elem ements ents.Add Add(un (unorderedList); } private void AddTextF t ield(Group pageE eElem lemennts, oaat x, ooatt y) { TextFFieldd ield txt = new T ew extF extField eld(txtfna fnaaame, me me, me, x + x + 20, 20, y + y +
tte aa dTeextArea(formattedHtml, x + + 5, 5 y ++ 20, 20 2 215, 15 60, FontFFamilyy.Heelvetica, 9, f false) se ; / // Set Sets th s the in e dent property formattedTextArea.Style.Paragraph.Inde In nnt = 118 8; AddCapt Cap ionAndRe ndRectan aa gle( e g page pagee p Elem Elem E ents, F Forma m ormatted tted ted tedTe TextArea rea P
atte at at dTeextArea Overow Te e Text:, x + 279, y 9, y); p ; pageE geElements.AAdd(form formattedTextAArea); a) // C Creat ea ee an overow formatted text area for the overow text Fo Form mattedT tedTextA xt reaMMax axLe Length ngth = 9 = 9 = 9; tx tx tx txxt1.B 1.Borde de d rCo rColor = r = RgbColo lo Coloor.B r.B Blaack; txt txt1.Ba 1 Ba
Ma MMM ximuum Length gth; p ; ageEE geEEleme ements. nts.Add( Add(txt txt1); T TextF ex ieldd txt2 = neew TeextField(txxtf2name name, x x + 3 + 30, y + 30, 150, 40); txt2.DefaultValue = This is a TexxtF tFieldd whiichh goees to to to t the nexxt li t li line i ne iif th ff t e text e t e t xcee xceeds w ds wid idth; ; ttxt2. xt2. xt2 xt2 MMMult Mu iLin Line = e =
Rg RR bCooolor.AliceBlue Bluee; txt2.T 2. oolTip == M Multiline; ppageEElemennts.A Add(ttxt2); AddCap Caption t AndR AndRecctangle(pageElements, TextField Form Page Element:, x , x, y, 504 504 44, 85 85); } ; } pr rivate voi oidd AddCom CCC boFi bo eld(Group pa p pageEl geEleme emen en e ttts, ts oat x,
, , y + 4000, 150,, 20 20) 20); c ; cb.Bor o derC d olor = RgbColorr.BBlack; cb.Baackg grounndColor = RgbC RgbColor o .Ali AliceB ceBlue; cb.Font = Font.Helvetica; cb.FontSize = 12; cb.Items em .AAdd( (It (( em 1 m 1); ; ccb.IItems te .Add(It Item 2 em 2); ); cb.I cb.Items ems.Add(Item 3 em 3)); cb.IItems
aaabbble b ].SSe Se Sele lec lected = true; cb.Ed b itable = true; cb.To Tool olTip = Editable Co e Combo Box; pa ; pageEl geE eme ments.Add(cb); ComboBox cb1 = new ComboBox(cmb1nam ame, x + 303, 03 0 y + y + 4440 40, 150, 200); c ); cb1.B b1.B b1 orde orderCol rColoor = Rgb g Coloor.Bl r.B r B r B ack; ack cb1.Bac
.F ..FFFont ontSize = 12; cb1.Items.Add(Item 1); cb1.Items.A Add(Item 2 em 2); ccb1.Items.Add((Item em 3); cb1.Items.Add(Item 4); cb1.Items.Add(Non-Editable); ); cb111.Items[NNon-E on-Editable].Select eccc ed = ed = tru true; c e; cb1 E b1.EEditable e = fa = f lse; se cb1.ToolT
eerrter.Coonvert(http://www.google.com, Output.pdf) );Convverteer.Co onvert(GetDoc D Path Path(Do (D cumentA.rtf), Output.pdf);System.Diagnostics.Process. . s SStartt(O t( uutpu utpu utputt.pdf); ); AsyncCo Conver nverrtter t aCon aConvert verter = e new e AsyncC ncConnverter(); aC
vveerted); aConverter.ConversionError += new ConversiionErro orEv ventH Handler(aConveerte er_ConversionError); aConverter.Convert(@C:\temp\DocumentA.rt A f, f , f @C: C \tem te p\Ou O tput tputA.pd A.pdf); f); aCo aCo a nverter.Convert( ert @C:\tem e p\Do p\D cumentB
\Doc \D ummentC.rtf, @C:\temp\OutputC.pdf); aConverrter.Coonver rt(h http://www.yahoo.c oo.com, @C:\Temp\yahoo.pdf); Conv C ersionOptions op s option tions = nneew new new ew Conversi s e onOp Option tion oo s(72 s(720, 7 0, 720, 72, 7 true); ceTe.Dyna DynamicP m DF.C DF.Conve on rsio rsion Co n.Co
outp ou ut.pdf, options o ); ceTe.DynamicPDF.Conversion.C Conveerter.Conv Con ert(C:\\temp\\\Docum ocument2.docx, C:\\temp\\o p\ utput.pdf, opti pt opti opti op ons) ons); s ; string ing sampleH ple tml m = < <html html><bo ><bo b dy dy><p>This i s s a very simplee HTML HTML HT HT str str s ing in ing in incl inc inc includin ud ng a g a g TT
( g[] g )
{{
pp
gg g ( p p )
[ ]
[ ]
pp y y yyp
HighhSecu Sec rity securit urity y new w HighhSecuurityy(OOwnerPassword, U serPassword)
yy ppy
ees y yy
p
( p p )
pag p ( p pp )
p ()
}
GI<:@J<CP
GIF>I8DD<;
=FIJG<<;
TRY 0UR PDF S0LUT!0NS FREE T0DAY!
www.DynamicPDF.ccm/evaI or call S00.6S!.500S | +! 4!0.772.S620
Dyra|cPDfCoprebers|ve PDf So|ut|ors for .NLI Deve|opers
ceTe 5oItware's DynamicPDF products provide realtime PDF generation, manipulation, conversion,
printing, viewing, and much more. Providing the best oI both worlds, the ob|ect models are extremely
hexible but still supply the rich Ieatures you need as a developer. Peliable and eIcient, the high
perIormance soItware is easy to learn and use. II you do encounter a question with any oI our
components, simply contact ceTe 5oItware's readily available, industryleading support team.
WWW.DYNAM!CPDF.C0M
Untitled-3 1 12/7/10 3:17 PM
msdn magazine 64 Business Connectivity Services
external lists involved in the deployment process. Terefore, theres
no need for SharePoint homepage and SharePoint Workspace,
though we still employ the SharePoint Server metadata store.
In this deployment process, afer the ECTs are published into
SharePoint metadata store, we use SharePoint Designer to export
the ECTs into a model fle (.bdcm). You can run SharePoint Designer
either on the server machine or on your client machine and you can
place the exported model fle in a shared folder. Te BCS Solution
Packaging Tool reads the model fle and generates a Visual Studio
Tools for Of ce (VSTO) installation package that can be run by users.
From the users perspective, this is a simple, easy and transpar-
ent installation process. Users only click once when running the
setup.exe to install all ECTs exported from SharePoint Designer.
Te installation will also immediately start BCSSync.exe to run the
ECTs and download ECT data directly from external systems into
the BCS local data cache.
The Excel Add-In
As described earlier, we redesigned the existing Windows Forms
application component into an Excel add-in component and used
Excel as the UI for managing employee rewards. Te Excel add-in
performs the following main functions:
Renders employee records and related guidance and
statistics as an Excel worksheet and task pane.
Uses BCS APIs to retrieve employee and business rule data
from the BCS local cache, and writes back any changes to
the BCS local update queue.
Invokes existing business logic code when users make
changes to employee rewards to ensure the changes meet
corresponding guidelines and minimum/maximum ranges.
Figure 5 shows the new Excel-based UI for rewards manage-
ment. Te top half of the screen is an Excel worksheet displaying
employee records for the users organization. Te bottom half of
the screen is a task pane that shows the guidelines for the high-
lighted employee (selected row) and statistics for the organization.
Guidelines and statistics for selected columns will be displayed on
the bottom screen.
Tis simple and easy-to-use Excel interface helps managers and
HR personnel efectively manage their employee rewards. Teyll
perform all their work on one screen and still see the overall
rewards picture for their organizations. Of course, they can build
additional statistics and charts based on worksheet employee data
using native Excel functions such as pivot tables and pivot charts.
When the Excel program is started, theres a custom Rewards
tab added by the Excel add-in in the menu bar. Users click the
Rewards tab and a ribbon is shown with various buttons for users
to start and use the rewards-management solution.
Using the BCS APIs
Of course, the BCS APIs lie at the center of any BCS-based solution.
Lets walk through some of our sample code to illustrate the use
of BCS APIs.
First, lets take a look at some code used to retrieve all employee
records from the local cache store (see Figure 6).
IEntity is the main BCS interface for ECTs you defne for your
solution. IEntityInstance represents a specifc data instance for the
entity you want to get data from. Each ECT has a unique entity
name within an entity name space. Each entity instance is identi-
fed by a unique ID you defne when you defne the ECT. In this
case, its the employee number.
You can update an employee record (or, more specifcally, an
employee ECT instance) through a BCS entity instance update
method. Tis creates an update operation in the BCS local queue.
Thus there will be 10 operations queued in local cache if you
make changes to 10 employee records. BCS sync will process one
operation at a time, like so:
// Query the employee instance you want to change
Identity identity = new Identity(employeeNumber);
IEntityInstance myEmployee =
entity.FindSpecific(identity, LobSysteminstance);
// Update the employee bonus amount
myEmployee["BonusAmount"] = 1000;
// Submit the changes to BCS local cache
myEmployee.Update();
Te code in Figure 7 shows how to query the BCS cache for all
pending or failed operations due to external system unavailable,
error and data conficts.
ISynchronizationManager is the main interface for the BCS
entity-synchronization process. Each operation (IOperation) is a
change to entity data to be processed by the BCS runtime. Afer
processing, each data update operation will have a status of either
Pending or In Error. If an operation is processed successfully, the
string entityNameSpace = "MSIT.HR.Rewards.BCS";
string entityName = "EmployeeDetails";
// Initialize and connect to BCS local cache
RemoteSharedFileBackedMetadataCatalog catalog =
new RemoteSharedFileBackedMetadataCatalog();
// Get the ECT for employee entity
IEntity entity = catalog.GetEntity(@entityNameSpace, entityName);
// Get the finder method defined for employee ECT
string methodName = entity.GetMethodInstance(
MethodInstanceType.Finder)[0].Value.Name;
IMethodInstance mi = entity.GetMethodInstance(
methodName, MethodInstanceType.Finder);
// Get external system instance
ILobSystemInstance LobSysteminstance =
entity.GetLobSystem().GetLobSystemInstances()[0].Value;
// Retrieves all instances of employee ECT
IEntityInstanceEnumerator instanceEnumerator =
entity.FindFiltered(entity.GetDefaultFinderFilters(),
mi, LobSysteminstance, OperationMode.CachedWithoutRefresh);
// Loop each employee and add it to Excel worksheet list object
while (instanceEnumerator.MoveNext()) {
... // Loop each instance of employee record and
// add it to Excel worksheet list object
}
Figure 6 Retrieving Employee Records
Each ECT has a unique
entity name within an entity
name space.
(888) 850-9911
Sales Hotline - US & Canada:
/update/2011/02
US Headquarters
ComponentSource
650 Claremore Prof Way
Suite 100
Woodstock
GA 30188-5188
USA
1996-2011 ComponentSource. All Rights Reserved. All prices correct at the time of press. Online prices may vary from those shown due to daily fluctuations & online discounts.
European Headquarters
ComponentSource
30 Greyfriars Road
Reading
Berkshire
RG1 1PE
United Kingdom
Asia / Pacific Headquarters
ComponentSource
3F Kojimachi Square Bldg
3-3 Kojimachi Chiyoda-ku
Tokyo
Japan
102-0083
www.componentsource.com
www.componentsource.com
We accept purchase orders.
Contact us to apply for a credit account.
BEST SELLER
TX Text Control .NET for Windows Forms/WPF from $499.59
Word processing components for Visual Studio .NET.
- Add professlonal word processlng to your appllcatlons
- Poyalty-free wlndows Porms and wPP rlch text box
- True wS|wG, nested tables, text frames, headers and footers, lmages, bullets,
structured numbered llsts, zoom, dlalog boxes, sectlon breaks, page columns
- Load, save and edlt DOCX, DOC, PDP, PDP/A, PTP, HTML, TXT and XML
NEW VERSION
FusionCharts from $195.02
Interactive Flash & JavaScript (HTML5) charts for web apps.
- Llven up your web appllcatlons uslng anlmated & data-drlven charts
- Create A1AX-enabled charts wlth drlll-down capabllltles ln mlnutes
- Lxport charts as lmages/PDP and data as CSv from charts ltself
- Create gauges, dashboards, nanclal charts and over 550 maps
- Trusted by over l7,000 customers and 330,000 users ln ll0 countrles
BEST SELLER
BEST SELLER
Spread for Windows Forms from $959.04
A comprehensive Excel compatible spreadsheet component for Windows Forms applications.
- Speed development wlth Spreadsheet Deslgners, Qulck-start wlzard and Chart Deslgners
- Automatlc completlon - provlde "type ahead" from user lnput to cell
- Peatures bullt-ln tool to deslgn charts wlth 85 dlnerent styles
- Preserves Lxcel les and restores unsupported functlonallty
- |ncludes sleek new predened sklns and the ablllty to create custom sklns
BEST SELLER
BEST SELLER
ActiveReports 6 from $685.02
Latest release of the best selling royalty free .NET report writer.
- Now supports wlndows Server 2008, 648lt & |L8.0
- Plrst Plash based Peport vlewer for end users
- Supports PDP Dlgltal Slgnatures, PSS 8ar Codes and external stylesheets
- Peatures an easy-to-use vlsual Studlo report deslgner and a powerful AP|
- Oners seamless run-tlme deployment, royalty free
BEST SELLER
Untitled-9 1 1/6/11 3:31 PM
msdn magazine 66 Business Connectivity Services
operation is removed from the queue and you wont be able to query
the operation through the synchronization manager.
A Pending status indicates the operation is pending due to
external system unavailability. BCS will automatically retry until
its successful or encounters an error.
An In Error status indicates that the operation failed to be
processed by external systems due to a validation error, a data
integrity error or a conficting data error.
Tere will be a time when users want to explicitly refresh their
local cache from external systems, instead of waiting for the BCS
runtime to sync periodically. Heres how you force a refresh of data
for all ECTs:
// Initialize and connect to offline cache
RemoteOfflineRuntime offlineRuntime = new RemoteOfflineRuntime();
ISubscriptionManager subManager =
offlineRuntime.GetSubscriptionManager();
// Get all subscriptions
ISubscriptionCollection mysubs = subManager.GetSubscriptions();
IEnumerator<ISubscription> ie = mysubs.GetEnumerator();
while (ie.MoveNext()) {
ISubscription mySub = ie.Current;
mySub.RequestRefresh(true);
}
As mentioned earlier, the first time an ECT is deployed and
installed on a users machine, the BCS runtime creates a sub-
scription to the data from external systems in its local data store.
Te subscription is being used by the BCS runtime to synchronize
the ECT data with external systems.
In the sample code, ISubscriptionManager is the interface to get
all subscriptions (ISubscription) created in the BCS data store. With
a subscription object you can do a number of things, including
changing the sync frequency for the ECT, adding additional query
parameters, getting the last refresh status, requesting a refresh
immediately (as in the example) and getting the number of
instances synced for the ECT.
Lessons Learned
During the design, development and deployment of the new
rewards-management solution, we gained much practical, real-world
experience with both Of ce add-in development and SharePoint
2010 BCS implementation. Here are some of the insights we gleaned
along the way:
First, spend as much time as you can designing the ECTs for
your solution. ECT design is key to a successful BCS solution.
ECTs directly affect the behavior of BCS runtime, and a badly
designed ECT can cause the BCS runtime to crash or throw out-
of-memory exceptions.
We learned this lesson the hard way. We initially designed a
big ECT that returned all business rules as a single instance. Te
single instance contained a 40MB array that caused the BCS
runtime to peak at 600MB of memory use when the array was
de-serialized to objects.
To mitigate memory-use problems, we then redesigned the
big ECT into a few separate ECTs based on rule categories. Each
category ECT returns a number of entity instances equal to the
actual number of rules. With these new, more-focused ECTs, the
BCS sync process works much more ef ciently.
Another best practice is to use strong typing and a relatively fat
structure as much as possible to defne your ECTs. If you can use
SharePoint Designer to generate ECTs, it will save a lot of devel-
opment time. Creating ECTs in Visual Studio with a lot of entity
attributes gives you more fexibility, but it can be a time-consuming
and tedious process.
Tink through your requirements as to how much data can be
downloaded and cached to a users local machine. Tis determines
how youll implement the fnder method for your ECT. Of course,
the data returned from your external system calls sets the limit for
the number of records you can download. If your ECT design needs
more data than the limit, then the external systems will need to be
changed to meet your requirement.
In our rewards solution, a manager can download and cache the
employee records for his organization only. Tus, two diferent users
are likely to have two diferent sets of employee data downloaded
to their local cache. Te existing Rewards Web Services authenti-
cate the user and return only the employee data the user is allowed
to access. In other words, the data fltering is done at the external
systems and the ECT implementation doesnt have to flter the data
based on user permissions. If this is not the case for your solution,
youll need to consider additional design and development time
for fltering ECT data for the local cache.
In your ECT implementation, handle external system exceptions
carefully. At some point, your ECT implementations for the Finder
and SpecifcFinder methods will need to invoke external system
methods to retrieve data. Youll need to catch and handle exceptions
thrown from external systems in your code. However, youll need
// Initialize and connect to offline cache store
RemoteOfflineRuntime offlineRuntime = new RemoteOfflineRuntime();
ISynchronizationManager syncManager =
offlineRuntime.GetSynchronizationManager();
IMetadataCatalog catalog =
offlineRuntime.GetMetadataCatalog();
// Get all current operations from local operation queue
IOperationCollection allOps = syncManager.GetOperations();
foreach (IOperation op in allOps) {
// ECT associated with the operation
IEntity entity = op.Entity;
// Query for operation status
string operationstatus = op.OperationStatus.ToString();
// Query for operation retry count
int retryCount = op.RetryCount;
// Get last exception message if operation errored out
string errMsg = op.LastException.Message;
// Retry the operation if status is pending or error
op.Retry();
// Decide if error is due to data conflict
if (errMsg.Contains("ConflicDetectedException"))
// Then the error is due to data conflict
}
Figure 7 Checking for Pending or Failed Operations
ECT design is key to a successful
BCS solution.
67 February 2011 msdnmagazine.com
to throw the exception back to the BCS runtime afer you handle
it. Otherwise, the BCS runtime will think the call to the external
systems was successful, return zero rows of data and remove the
data already in the local cache. You defnitely dont want the local
data cache deleted because of an external system exception.
Tere are additional considerations regarding the use of third-
party libraries in your ECT implementation. In one of our ECTs,
we had to reference an assembly developed by another group to
perform additional business logic and data transformation. During
the deployment of the ECT, we found that the referenced assembly
wasnt deployed to client machines as part of the ECT installation.
As a result, BCS failed to run the ECT and download the data.
As I write this, were working with the BCS product team to
engineer a solution. Te workaround is to add the assembly to the
Global Assembly Cache as part of the VSTO installation.
Its very important to test and debug your ECTs. Teyre run by
the BCS runtime in the background and you cant debug ECTs from
Visual Studio when theyre running on client machines. Our rec-
ommendation is that you test and debug your ECTs on the server
side by creating external lists in SharePoint. When you view and
change the content of an external list on a SharePoint List page,
youre running the ECT code associated with the external list and
you can debug the ECT from a Visual Studio instance running on
the same SharePoint server.
Finally, its vitally important that you understand the BCS API
entity operation mode. In the client-side application using BCS
APIs to manipulate ECT entity instances, there are four operation
modes you can use to manage ECT data. Heres a quick overview
of how they work:
OperationMode.CacheWithoutRefresh: When
this operation mode is used for an entity instance, BCS
returns the entity instance from the cache. If data isnt in
the cache, BCS refreshes the cache from external systems
and returns the cached copy. If the external systems cant
be contacted, BCS throws an exception.
OperationMode.CacheWithImmedicateRefresh:
With this operation mode, BCS refreshes the entity instance
in the cache frst from the external system and then returns
the cached copy. If the external system cant be contacted,
BCS still returns the cached copy. If the entity instance is
not cached and the external system cant be contacted, BCS
throws an exception.
OperationMode.Offline: With offline operation
mode, external systems are never contacted even if theres
no data in the cache. BCS returns the entity instance from
the cache. If its not there, BCS throws an exception.
OperationMode.Online: For online operation mode,
BCS will never use local cached data and will always contact
external systems to get a copy of the entity instance. If the
external system cant be contacted, BCS throws an exception.
Wrapping Up
Microsof Of ce and SharePoint 2010 with BCS provide the founda-
tion for implementing a simple, easy-to-use and powerful solution
for businesses to manage enterprise data from multiple external
systems with familiar Of ce UIs. Tis foundation facilitates busi-
ness data and process availability anywhere and anytime, therefore
increasing business productivity.
BCS synchronization infrastructure solves many problems
associated with data copies, changes and conflicts. One of the
advantages of BCS synchronization over other data-synchronization
frameworks is that BCS allows your solutions to embed business
and data-validation logic in the synchronization process through
ECT implementations. Another benefit of BCS is the ability to
synchronize composite data from multiple disparate systems (again
through ECT design), instead of the point-to-point data synchro-
nization that many other synchronization frameworks provide.
YING XIONG is a principal architect on the Microsof IT team, architecting and
designing enterprise applications and integrations within Microsof. He works on
a variety of Microsof technologies for building distributed enterprise applications.
You can reach Xiong at yingx@microsof.com.
THANKS to the following technical experts for reviewing this article:
Rolando Jimenez Salgado and Satish Tatte
Its important to test and
debug your ECTs.
msdn magazine 68
PARALLEL COMPUTI NG
Its All About the
SynchronizationContext
Multithreaded programming can be quite dif cult,
and theres a tremendous body of concepts and tools to learn
when one embarks on this task. To help out, the Microsoft .NET
Framework provides the SynchronizationContext class. Unfortu-
nately, many developers arent even aware of this useful tool.
Regardless of the platformwhether its ASP.NET, Windows Forms,
Windows Presentation Foundation (WPF), Silverlight or others
all .NET programs include the concept of SynchronizationContext,
and all multithreading programmers can beneft from understand-
ing and applying it.
Stephen Cleary
The Need for SynchronizationContext
Multithreaded programs existed well before the advent of the .NET
Framework. Tese programs ofen had the need for one thread to pass
a unit of work to another thread. Windows programs were centered
on message loops, so many programmers used this built-in queue to
pass units of work around. Each multithreaded program that want-
ed to use the Windows message queue in this fashion had to defne
its own custom Windows message and convention for handling it.
When the .NET Framework was first released, this common
pattern was standardized. At that time, the only GUI application
type that .NET supported was Windows Forms. However, the
framework designers anticipated other models, and they developed
a generic solution. ISynchronizeInvoke was born.
Te idea behind ISynchronizeInvoke is that a source thread
can queue a delegate to a target thread, optionally waiting for that
delegate to complete. ISynchronizeInvoke also provided a property
to determine whether the current code was already running on
the target thread; in this case, queuing up the delegate would be
unnecessary. Windows Forms provided the only implementation
of ISynchronizeInvoke, and a pattern was developed for designing
asynchronous components, so everyone was happy.
Version 2.0 of the .NET Framework contained many sweeping
changes. One of the major improvements was introducing asyn-
chronous pages to the ASP.NET architecture. Prior to the .NET
This article discusses a prerelease version of Visual Studio Async.
All information is subject to change.
This article discusses:
The need for SynchronizationContext
The concept of SynchronizationContext
The implementations of SynchronizationContext
AsyncOperationManager and AsyncOperation
Examples of library support for SynchronizationContext
Technologies discussed:
ASP.NET, Windows Forms, Windows Presentation Foundation,
Silverlight
69 February 2011 msdnmagazine.com
Framework 2.0, every ASP.NET request needed a thread until
the request was completed. Tis was an inef cient use of threads,
because creating a Web page ofen depends on database queries
and calls to Web services, and the thread handling that request
would have to wait until each of those operations fnished. With
asynchronous pages, the thread handling the request could begin
each of the operations and then return back to the ASP.NET thread
pool; when the operations finished, another thread from the
ASP.NET thread pool would complete the request.
However, ISynchronizeInvoke wasnt a good ft for the ASP.NET
asynchronous pages architecture. Asynchronous components
developed using the ISynchronizeInvoke pattern wouldnt work
correctly within ASP.NET pages because ASP.NET asynchronous
pages arent associated with a single thread. Instead of queuing work
to the original thread, asynchronous pages only need to maintain
a count of outstanding operations to determine when the page
request can be completed. Afer much thought and careful design,
ISynchronizeInvoke was replaced by SynchronizationContext.
The Concept of SynchronizationContext
ISynchronizeInvoke satisfed two needs: determining if synchroni-
zation was necessary, and queuing a unit of work from one thread
to another. SynchronizationContext was designed to replace
ISynchronizeInvoke, but afer the design process, it turned out to
not be an exact replacement.
One aspect of SynchronizationContext is that it provides a way to
queue a unit of work to a context. Note that this unit of work is queued
to a context rather than a specifc thread. Tis distinction is impor-
tant, because many implementations of SynchronizationContext
arent based on a single, specifc thread. SynchronizationContext
does not include a mechanism to determine if synchronization is
necessary, because this isnt always possible.
Another aspect of SynchronizationContext is that every thread
has a current context. A threads context isnt necessarily unique;
its context instance may be shared with other threads. Its possible
for a thread to change its current context, but this is quite rare.
A third aspect of SynchronizationContext is that it keeps a
count of outstanding asynchronous operations. Tis enables the
use of ASP.NET asynchronous pages and any other host needing
this kind of count. In most cases, the count is incremented when
the current SynchronizationContext is captured, and the count is
decremented when the captured SynchronizationContext is used
to queue a completion notifcation to the context.
Tere are other aspects of SynchronizationContext, but theyre
less important to most programmers. Te most important aspects
are illustrated in Figure 1.
The Implementations of SynchronizationContext
Te actual context of the SynchronizationContext isnt clearly defned.
Diferent frameworks and hosts are free to defne their own context.
Understanding these diferent implementations and their limitations
clarifes exactly what the SynchronizationContext concept does and
doesnt guarantee. Ill briefy discuss some of these implementations.
WindowsFormsSynchronizationContext (System.
Windows.Forms.dll: System.Windows.Forms) Windows Forms apps
will create and install a WindowsFormsSynchronizationContext as
the current context for any thread that creates UI controls. Tis
SynchronizationContext uses the ISynchronizeInvoke methods on
a UI control, which passes the delegates to the underlying Win32
message loop. Te context for WindowsFormsSynchronization-
Context is a single UI thread.
All delegates queued to the WindowsFormsSynchronization-
Context are executed one at a time; theyre executed by a specifc
UI thread in the order they were queued. Te current implemen-
tation creates one WindowsFormsSynchronizationContext for
each UI thread.
DispatcherSynchronizationContext (WindowsBase.dll:
System.Windows.Treading) WPF and Silverlight applications use a
DispatcherSynchronizationContext, which queues delegates to the
UI threads Dispatcher with Normal priority. Tis Synchronization-
Context is installed as the current context when a thread begins
its Dispatcher loop by calling Dispatcher.Run. The context for
DispatcherSynchronizationContext is a single UI thread.
All delegates queued to the DispatcherSynchronizationContext
are executed one at a time by a specifc UI thread in the order they
were queued. Te current implementation creates one Dispatcher-
SynchronizationContext for each top-level window, even if they
all share the same underlying Dispatcher.
Default (ThreadPool) SynchronizationContext
(mscorlib.dll: System.Treading) Te default Synchronization Context
is a default-constructed SynchronizationContext object. By con-
vention, if a threads current SynchronizationContext is null, then
it implicitly has a default SynchronizationContext.
Te default SynchronizationContext queues its asynchronous
delegates to the ThreadPool but executes its synchronous dele-
gates directly on the calling thread. Therefore, its context covers
// The important aspects of the SynchronizationContext APIclass
SynchronizationContext
{
// Dispatch work to the context.
void Post(..); // (asynchronously)
void Send(..); // (synchronously)
// Keep track of the number of asynchronous operations.
void OperationStarted();
void OperationCompleted();
// Each thread has a current context.
// If "Current" is null, then the thread's current context is
// "new SynchronizationContext()", by convention.
static SynchronizationContext Current { get; }
static void SetSynchronizationContext(SynchronizationContext);
}
Figure 1 Aspects of the SynchronizationContext API
One aspect of
SynchronizationContext is that
it provides a way to queue a unit
of work to a context.
msdn magazine 70 Parallel Computing
all TreadPool threads as well as any thread that calls Send. Te
context borrows threads that call Send, bringing them into its
context until the delegate completes. In this sense, the default
context may include any thread in the process.
The default SynchronizationContext is applied to Thread-
Pool threads unless the code is hosted by ASP.NET. The default
SynchronizationContext is also implicitly applied to explicit child
threads (instances of the Tread class) unless the child thread sets
its own SynchronizationContext. Thus, UI applications usually
have two synchronization contexts: the UI SynchronizationContext
covering the UI thread, and the default SynchronizationContext
covering the TreadPool threads.
Many event-based asynchronous components dont work as
expected with the default SynchronizationContext. An infamous exa-
mple is a UI application where one BackgroundWorker starts another
BackgroundWorker. Each BackgroundWorker captures and uses the
SynchronizationContext of the thread that calls RunWorkerAsync
and later executes its RunWorkerCompleted event in that context.
In the case of a single BackgroundWorker, this is usually a UI-based
SynchronizationContext, so RunWorkerCompleted is executed in
the UI context captured by RunWorkerAsync (see Figure 2).
However, if the BackgroundWorker starts another Background-
Worker from its DoWork handler, then the nested Background-
Worker doesnt capture the UI SynchronizationContext. DoWork is
executed by a TreadPool thread with the default Synchronization-
Context. In this case, the nested RunWorkerAsync will capture the
default SynchronizationContext, so it will execute its RunWorker-
Completed on a TreadPool thread instead of
a UI thread (see Figure 3).
By default, all threads in console applications
and Windows Services only have the default
SynchronizationContext. This causes some
event-based asynchronous components to fail.
One solution for this is to create an explicit
child thread and install a Synchronization-
Context on that thread, which can then provide
a context for these components. Implementing a Synchronization-
Context is beyond the scope of this article, but the ActionTread
class of the Nito.Async library (nitoasync.codeplex.com) may be used
as a general-purpose SynchronizationContext implementation.
AspNetSynchronizationContext (System.Web.dll: System.
Web [internal class]) The ASP.NET SynchronizationContext is
installed on thread pool threads as they execute page code. When a
delegate is queued to a captured AspNetSynchronizationContext,
it restores the identity and culture of the original page and then
executes the delegate directly. Te delegate is directly invoked even
if its asynchronously queued by calling Post.
Conceptually, the context of AspNetSynchronizationContext is
complex. During the lifetime of an asynchronous page, the context
starts with just one thread from the ASP.NET thread pool. Afer the
asynchronous requests have started, the context doesnt include any
threads. As the asynchronous requests complete, the thread pool threads
executing their completion routines enter the context. Tese may be
the same threads that initiated the requests but more likely would be
whatever threads happen to be free at the time the operations complete.
If multiple operations complete at once for the same application,
AspNetSynchronizationContext will ensure that they execute one
at a time. Tey may execute on any thread, but that thread will have
the identity and culture of the original page.
One common example is a WebClient used from within an asyn-
chronous Web page. DownloadDataAsync will capture the current
SynchronizationContext and later will execute its DownloadData-
Completed event in that context. When the page begins executing,
ASP.NET will allocate one of its threads to execute the code in that
page. Te page may invoke DownloadDataAsync and then return;
ASP.NET keeps a count of the outstanding asynchronous operations,
so it understands that the page isnt complete. When the WebClient
object has downloaded the requested data, it will receive notifcation on
a thread pool thread. Tis thread will raise DownloadDataCompleted
in the captured context. Te context will stay on the same thread but
will ensure the event handler runs with the correct identity and culture.
Notes on SynchronizationContext
Implementations
SynchronizationContext provides a means for writing components
that may work within many diferent frameworks. Background-
Worker and WebClient are two examples that are equally at home
in Windows Forms, WPF, Silverlight, console and ASP.NET apps.
However, there are some points that must be kept in mind when
designing such reusable components.
Generally speaking, SynchronizationContext implementations
arent equality-comparable. Tis means that theres no equivalent to
Figure 3 Nested BackgroundWorkers in a UI Context
UI SyncContext Default (ThreadPool) SyncContext
RunWorkerCompleted RunWorkerCompleted
RunWorkerAsync
DoWork
DoWork
RunWorkerAsync
Figure 2 A Single BackgroundWorker in a UI Context
UI SyncContext Default (ThreadPool) SyncContext
RunWorkerCompleted
RunWorkerAsync DoWork
Many event-based
asynchronous components
dont work as expected with the
default SynchronizationContext.
Project3 12/16/09 11:55 AM Page 1
msdn magazine 72 Parallel Computing
ISynchronizeInvoke.InvokeRequired. However, this isnt a tremendous
drawback; code is cleaner and easier to verify if it always executes within
a known context instead of attempting to handle multiple contexts.
Not all SynchronizationContext implementations guarantee the
order of delegate execution or synchronization of delegates. Te
UI-based SynchronizationContext implementations do satisfy
these conditions, but the ASP.NET SynchronizationContext only
provides synchronization. Te default SynchronizationContext
doesnt guarantee either order of execution or synchronization.
Tere isnt a 1:1 correspondence between SynchronizationContext
instances and threads. Te WindowsFormsSynchronization Context
does have a 1:1 mapping to a thread (as long as Synchronization-
Context.CreateCopy isnt invoked), but this isnt true of any of the
other implementations. In general, its best to not assume that any
context instance will run on any specifc thread.
Finally, the SynchronizationContext.Post method isnt necessarily
asynchronous. Most implementations do implement it asynchro-
nously, but AspNetSynchronizationContext is a notable exception.
Tis may cause unexpected re-entrancy issues. A summary of these
diferent implementations can be seen in Figure 4.
AsyncOperationManager and AsyncOperation
The AsyncOperationManager and AsyncOperation classes in
the .NET Framework are lightweight wrappers around the
SynchronizationContext abstraction. AsyncOperationManager
captures the current SynchronizationContext the frst time it creates
an AsyncOperation, substituting a default SynchronizationContext
if the current one is null. AsyncOperation posts delegates asyn-
chronously to the captured SynchronizationContext.
Most event-based asynchronous components use Async-
OperationManager and AsyncOperation in their implementation.
Tese work well for asynchronous operations that have a defned
point of completionthat is, the asynchronous operation begins at
one point and ends with an event at another. Other asynchronous
notifcations may not have a defned point of completion; these may
be a type of subscription, which begins at one point and then con-
tinues indefnitely. For these types of operations, Synchronization-
Context may be captured and used directly.
New components shouldnt use the event-based asynchronous
pattern. Te Visual Studio asynchronous Community Technology
Preview (CTP) includes a document describing the task-based asyn-
chronous pattern, in which components return Task and Task<TResult>
objects instead of raising events through SynchronizationContext.
Task-based APIs are the future of asynchronous programming in .NET.
Examples of Library Support for
SynchronizationContext
Simple components such as BackgroundWorker and WebClient
are implicitly portable by themselves, hiding the Synchronization-
Context capture and usage. Many libraries have a more visible use of
SynchronizationContext. By exposing APIs using Synchronization-
Context, libraries not only gain framework independence, they also
provide an extensibility point for advanced end users.
In addition to the libraries Ill discuss now, the current Synchro-
nizationContext is considered to be part of the ExecutionContext.
Any system that captures a threads ExecutionContext captures the
current SynchronizationContext. When the ExecutionContext is
restored, the SynchronizationContext is usually restored as well.
Windows Communication Foundation (WCF):
Use SynchronizationContext WCF has two attributes that
are used to confgure server and client behavior: ServiceBehavior-
Attribute and CallbackBehaviorAttribute. Both of these attributes
have a Boolean property: UseSynchronizationContext. Te default
value of this attribute is true, which means that the current
SynchronizationContext is captured when the communication
channel is created, and this captured SynchronizationContext is
used to queue the contract methods.
Normally, this behavior is exactly what is needed: Servers use
the default SynchronizationContext, and client callbacks use the
appropriate UI SynchronizationContext. However, this can cause
problems when re-entrancy is desired, such as a client invoking a
server method that invokes a client callback. In this and similar
cases, the WCF automatic usage of SynchronizationContext may
be disabled by setting UseSynchronizationContext to false.
Tis is just a brief description of how WCF uses Synchronization-
Context. See the article Synchronization Contexts in WCF
(msdn.microsoft.com/magazine/cc163321) in the November 2007 issue of
MSDN Magazine for more details.
Windows Workow Foundation (WF): Workow-
Instance.SynchronizationContext WF hosts originally used
WorkfowSchedulerService and derived types to control how workfow
private void button1_Click(object sender, EventArgs e)
{
// This TaskScheduler captures SynchronizationContext.Current.
TaskScheduler taskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
// Start a new task (this uses the default TaskScheduler,
// so it will run on a ThreadPool thread).
Task.Factory.StartNew(() =>
{
// We are running on a ThreadPool thread here.
; // Do some work.
// Report progress to the UI.
Task reportProgressTask = Task.Factory.StartNew(() =>
{
// We are running on the UI thread here.
; // Update the UI with our progress.
},
CancellationToken.None,
TaskCreationOptions.None,
taskScheduler);
reportProgressTask.Wait();
; // Do more work.
});
}
Figure 5 Progress Reporting with UI Updates
Task-based APIs are
the future of asynchronous
programming in .NET.
Untitled-1 1 1/11/10 10:55 AM
msdn magazine 74 Parallel Computing
activities were scheduled on threads. Part of the .NET Framework
4 upgrade included the SynchronizationContext property on the
WorkfowInstance class and its derived WorkfowApplication class.
Te SynchronizationContext may be set directly if the hosting
process creates its own WorkfowInstance. SynchronizationContext
is also used by WorkfowInvoker.InvokeAsync, which captures the
current SynchronizationContext and passes it to its internal Work-
fowApplication. Tis SynchronizationContext is then used to post
the workfow completion event as well as the workfow activities.
Task Parallel Library (TPL): TaskScheduler.From-
CurrentSynchronizationContext and Cancellation-
Token.Register Te TPL uses task objects as its units of work
and executes them via a TaskScheduler. Te default TaskScheduler
acts like the default SynchronizationContext, queuing the tasks to
the ThreadPool. Theres another TaskScheduler provided by the
TPL queue that queues tasks to a SynchronizationContext. Prog-
ress reporting with UI updates may be done with a nested task, as
shown in Figure 5.
Te CancellationToken class is used for any type of cancella-
tion in the .NET Framework 4. To integrate with existing forms
of cancellation, this class allows registering a delegate to invoke
when cancellation is requested. When the delegate is registered,
a SynchronizationContext may be passed. When the cancella-
tion is requested, CancellationToken queues the delegate to the
SynchronizationContext instead of executing it directly.
Microsoft Reactive Extensions (Rx): ObserveOn,
SubscribeOn and SynchronizationContextScheduler
Rx is a library that treats events as streams of data. Te ObserveOn
operator queues events through a SynchronizationContext, and
the SubscribeOn operator queues the subscriptions to those events
through a SynchronizationContext. ObserveOn is commonly used
to update the UI with incoming events, and SubscribeOn is used
to consume events from UI objects.
Rx also has its own way of queuing units of work: the IScheduler
interface. Rx includes SynchronizationContextScheduler, an imple-
mentation of IScheduler that queues to a SynchronizationContext.
Visual Studio Async CTP: await, ConfigureAwait,
SwitchTo and EventProgress<T> Te Visual Studio sup-
port for asynchronous code transformations was announced at the
Microsof Professional Developers Conference 2010. By default,
the current SynchronizationContext is captured at an await point,
and this SynchronizationContext is used to resume afer the await
(more precisely, it captures the current SynchronizationContext
unless it is null, in which case it captures the current TaskScheduler):
private async void button1_Click(object sender, EventArgs e)
{
// SynchronizationContext.Current is implicitly captured by await.
var data = await webClient.DownloadStringTaskAsync(uri);
// At this point, the captured SynchronizationContext was used to resume
// execution, so we can freely update UI objects.
}
ConfgureAwait provides a means to avoid the default Synchroni-
zationContext capturing behavior; passing false for the fowContext
parameter prevents the SynchronizationContext from being used to
resume execution afer the await. Teres also an extension method
on SynchronizationContext instances called SwitchTo; this allows
any async method to change to a diferent SynchronizationContext
by invoking SwitchTo and awaiting the result.
The asynchronous CTP introduces a common pattern for
reporting progress from asynchronous operations: the IProgress<T>
interface and its implementation EventProgress<T>. This class
captures the current SynchronizationContext when its constructed
and raises its ProgressChanged event in that context.
In addition to this support, void-returning async methods will
increment the asynchronous operation count at their start and
decrement it at their end. This behavior makes void-returning
async methods act like top-level asynchronous operations.
Limitations and Guarantees
Understanding SynchronizationContext is helpful for any program-
mer. Existing cross-framework components use it to synchronize
their events. Libraries may expose it to allow advanced fexibility.
Te savvy coder who understands the limitations and guarantees
of SynchronizationContext is better able to write and consume
such classes.
STEPHEN CLEARY has had an interest in multithreading ever since he frst heard
of the concept. Hes completed many business-critical multitasking systems for
major clients including Syracuse News, R. R. Donnelley and BlueScope Steel. He
regularly speaks at .NET user groups, BarCamps and Day of .NET events near
his home in Northern Michigan, usually on a multithreading topic. He maintains
a programming blog at nitoprograms.com.
THANKS to the following technical expert for reviewing this article:
Eric Eilebrecht
Specic Thread Used to
Execute Delegates
Exclusive (Delegates
Execute One at a Time)
Ordered (Delegates
Execute in Queue Order)
Send May Invoke
Delegate Directly
Post May Invoke
Delegate Directly
Windows Forms Yes Yes Yes If called from UI thread Never
WPF/Silverlight Yes Yes Yes If called from UI thread Never
Default No No No Always Never
ASP.NET No Yes No Always Always
Figure 4 Summary of SynchronizationContext Implementations
There isnt a 1:1
correspondence between
SynchronizationContext
instances and threads.
C O N N E C T I O N S
MARCH 27-30, 2011, ORLANDO
MEET US AT
WORD PROCESSING
COMPONENTS
WINDOWS FORMS / WPF / ASP.NET / ACTIVEX
MILES BEYOND RICH TEXT
TR
U
E W
Y
SIW
YG

P
O
W
ER
FU
L M
A
IL M
ER
G
E
M
S O
FFIC
E N
O
T R
EQ
U
IR
ED
P
D
F, D
O
C
X
, D
O
C
, R
TF &
H
TM
L
Word Processing Components
for Windows Forms & ASP.NET
TX Text Control Sales:
US +1 877 - 462 - 4772 (toll-free)
EU +49 421 - 4270671 - 0 WWW.TEXTCONTROL.COM
Untitled-1 1 1/11/11 11:45 AM
msdn magazine 76
TEAM FOUNDATI ON SERVER
Visual Studio TFS
Branching and
Merging Guidance
Since its inception in 2006, the Visual Studio ALM Rangers
team has operated within the Microsof developer division to pro-
mote collaboration between the Visual Studio product groups,
Microsof Services and the Microsof Most Valuable Professional
(MVP) community. Te standard vision statement of the Rangers
team is to accelerate the adoption of Visual Studio with out-of-band
solutions for missing features or guidance by addressing missing func-
tionality and removing adoption blockers. Te collaboration among
the variety of technology and business experts allows the Rangers to
empower communities by sharing real-world experience. (You can
learn more about the Rangers at msdn.microsoft.com/vstudio/ee358786.)
The Visual Studio Team Foundation Server (TFS) Branching
Guide 2010 (tfsbranchingguideiii.codeplex.com) consolidates insightful
Bill Heys and Willy-Peter Schaub
and practical guidance around branching and merging with Visual
Studio TFS 2010 by providing hands-on labs and lessons learned
from the community. In this article, well introduce you to some
of the advanced branching scenarios that were working on for the
next guidance version.
Branching: Todays State of the Nation
Te Rangers Branching Guidance started as a Rangers project afer
Visual Studio 2005 and TFS 2005 were released. Tis frst release of
the Rangers guidance was published on CodePlex in 2007.
In 2008, the Rangers kicked of the Branching Guidance II Project.
For this second release, we reorganized the guidance into a set of
related documents (Main, Scenarios, Q&A, Diagrams, Posters and
so on). Each of the secondary documents was intended to build
upon the primary guidance as presented in the Main branching
document. Ranger Branching Guidance II was published on Code-
Plex in late 2008.
In 2009, the Rangers team once again kicked of a new Branching
Guidance project: Branching Guidance 2010. This third release
focused on showing many new branching features in Visual Studio
2010 and TFS 2010. A key new feature in 2010 is branch visualization.
In part because the latest version is titled Rangers Visual Studio
TFS Branching Guide 2010, there has been some apparent confu-
sion whether this guidance applies exclusively to Visual Studio
2010. We want to make it clear that the best practices and guidance
presented in the 2010 guidance documents can continue to be
applied to earlier versions of Visual Studio and TFS. In fact, the
This article discusses:
The history of branching guidance
Guidance goals for the future
The Feature Team branching scenario
The common code-sharing branching scenario
The architecture tooling and modeling branching scenario
Technologies discussed:
Visual Studio Team Foundation Server 2010
Code download available at:
code.msdn.microsoft.com/mag201102ALM
77 February 2011 msdnmagazine.com
Rangers team has received positive feedback
from people using other tools for Source
Control Management (SCM).
For 2011, the Rangers team is once
again planning an update to the Rangers
Branching Guidance.
Feel free to post questions, candid feed-
back or concerns to the CodePlex site.
Branching Goals and Strategies
A key goal of branching is to provide iso-
lation between parallel streams of work. In
the current Rangers Branching Guidance
2010, we tended to focus more on release
isolation than on isolation during a com-
plex development initiative.
In many cases, all development activities
for the next release of a product can be owned
by a single development team. In this simple
case, only one development branch is needed
to isolate development from ongoing stabi-
lization (Main branch) or sustained engineering (shipping produc-
tion releases, along with ongoing hotfx and service pack support).
Te Rangers ofen get asked about support for more complex
development initiatives where a single development branch doesnt
provide enough fexibility or isolation for a larger product develop-
ment efort. In the next release of the Rangers Branching Guidance,
well be adding more direction in addressing complex development
scenarios such as feature team development.
We like to separate branching strategy discussions into two areas:
1. How does my organization develop sofware? Do we have
a smaller, simpler team structure or do we need to support
more complex teams with parallel development eforts?
2. How does my organization release sofware to its custom-
ers, either internal or external? Do we need to support
multiple released versions? Do we need to provide hot-
fxes or service packs?
In some scenarios, an organizations release
strategy may influence the development process,
particularly the structure of the development teams.
Ofen, however, the complexity of the release pro-
cess and branching strategy can be independent
from the complexity of the development process
and branching strategy.
In designing a branching strategy, consider not only
the branching structure, but also the branching pro-
cess. For example, in the basic branch plan described
in Rangers Branching Guidance 2010, there are only
three branches (Main, Development and Release).
A good branching strategy will describe the branch
relationships (for example, Main is a parent to both
the Development branch and the Release branch).
In addition, a branching strategy should describe
the process implied by the branching structure. For
example, how ofen do you build code in the Main
branch? How ofen do you merge code (forward integration) from
the Main branch to the Development branches? What are the con-
ditions for merging code (reverse integration) from a Development
branch back to the Main branch and so on? Lets discuss some
typical branching scenarios.
The Feature Team Scenario
Organizations often need a branching strategy to support large,
complex development efforts involving multiple development
teams or feature teams working in parallel. Questions arise about
how many separate development branches are needed. If I have
multiple development branches, when and how do I integrate
features developed by one team with features developed by other
teams? Answers to these questions should be incorporated into a
development-branching strategy.
F igure 1 Main and Integration Branches
B
r
a
n
c
h
B
r
a
n
c
h
B
r
a
n
c
h
R
e
v
e
r
s
e

I
n
t
e
g
r
a
t
i
o
n
R
e
v
e
r
s
e

I
n
t
e
g
r
a
t
i
o
n
R
e
v
e
r
s
e

I
n
t
e
g
r
a
t
i
o
n
INTEGRATION
MAIN
FEATURE-1
FEATURE-2
Integration Branch
Is Not Recommended
By Default
Fi gure 2 Feature Branching
B
r
a
n
c
h
R
e
v
e
r
s
e

I
n
t
e
g
r
a
t
i
o
n
F
o
r
w
a
r
d

I
n
t
e
g
r
a
t
i
o
n
F
o
r
w
a
r
d

I
n
t
e
g
r
a
t
i
o
n
F
o
r
w
a
r
d

I
n
t
e
g
r
a
t
i
o
n
F
o
r
w
a
r
d

I
n
t
e
g
r
a
t
i
o
n
R
e
v
e
r
s
e

I
n
t
e
g
r
a
t
i
o
n
MAIN
FEATURE-1
FEATURE-2
Build
OK
Testing
Complete
Ready to
Release
Testing
Complete
Ready to
Release
msdn magazine 78 Team Foundation Server
Lets start by describing a complex development initiative.
Although there may be a common release schedule for the entire
initiative, there may be several separate feature teams working
on independent milestones. As these features are completed and
tested, theyll be integrated into the Main branch.
On a single team, individual developers use local workspaces
to isolate their changes from others on their team. Feature Team
branches are a good way to isolate changes made by one Feature
Team from changes made by other Feature Teams working in
parallel on the same product. Without Feature Team isolation,
changes made by one team may introduce breaking changes that
impact the velocity of other teams.
Creating the branching structure for Feature Team isolation is
relatively straightforward. But frst, we need to plan for how the
Feature Team branches will be integrated later on. Do we add an
integration branch in between the Main branch and the Feature
Team branches, as shown in Figure 1?
Or do we eliminate the integration layer and integrate the Feature
Team changes another way? Whats the best practice recommendation?
We recommend minimizing the number of levels in a branching
hierarchy. Adding an integration layer between Main and
the Feature Team branches efectively doubles the merges
required to move changes between the Main branch and
the Feature branches. Branching helps isolate changes,
but the cost of branching is the resulting efort needed
to merge code between branches and to resolve merge
conficts that always seem to present themselves. Add-
ing an integration layer doubles the merges and likely
doubles the efort to resolve merge conficts.
If we eliminate the integration layer, we reduce the
number of layers in our branch hierarchy. But where
does the integration of Feature Team 1 and Feature
Team 2 happen, and where is the integration tested?
In order to keep the Main branch as stable as possible,
avoid introducing untested integra-
tion changes into the Main branch.
Without an integration layer, the
merging of features and testing
the integration must be done in a
controlled fashion in the Feature
Team branches themselves.
We recommend doing daily
builds in the Main (stable) branch
and, following a good daily build,
doing a merge from Main to the
Development (Feature) branches.
Dont merge code from a Feature
branch back to Main until the code
in the Feature branch is relatively
stable. In other words, the Feature
should pass quality assurance gates
before its merged with Main.
Only when the code in a Feature
branch is deemed ready to release
or ready to share with other teams
should we consider integrating this Feature branch with Main or
with other Feature branches. Figure 2 illustrates this process afer
each ready to release milestone.
Following are the process steps:
Before merging Feature Team 1 branch with Main, do one
fnal merge (forward integration, or FI) from Main to the
Feature Team 1 branch.
Complete a fnal test of this integration of code from Main
with code in the Feature Team 1 branch.
Once the code in the Feature Team 1 branch is stable, merge
this code (reverse integration, or RI) back to Main.
At this point, the code in Main incorporates the code from
Feature Team 1.
Perform a build and test in Main, equivalent to the daily
build. On the next successful build of Main, merge Main
to each of the Feature Team branches. Initially, this will
result in Feature Team 1 code being merged with the code
in Feature Team 2.
Test the integration of Feature Team 1 code with Feature
Team 2 code in the Feature Team 2 branch.
Figure 4 Evaluation Scenarios in a Test Environment to Test Possibility of
Branching and Merging
S1Dev1 S1Dev2
Scenario1
S2Dev1 S2Dev2
Scenario2
S3Dev1 S3Dev2
Scenario3
Main
Figure 3 Example of a Nested Branch Causing an Error in Team Foundation Server 2010
79 February 2011 msdnmagazine.com
When Feature Team 2 code is
ready for release or ready to share
with other teams, merge Feature
Team 2 code back to Main. But
first do one final merge from
Main to Feature Team 2 and test
the fnal integration.
Note: A key requirement for omitting
a separate integration layer is the ability
to use automated testing for the integra-
tions. Automated testing helps reduce the
impact on code velocity (that is, feature
team productivity) as the team works to
identify and resolve bugs that arise from
merging many changes into a branch.
If automated testing isnt available
for testing integration changes, the risk
is that code velocity of the feature teams will be adversely afected as
they undertake manual testing to identify and resolve bugs. In this
scenario, an organization might consider adding an integration layer
between Main and the Feature branches. As we previously noted, the
integration layer may result in increased merging and merge confict
resolution. But the beneft could be that having this layer may allow
for integration with less impact on code velocity of the feature teams.
A good branching strategy requires a sound branching structure
coupled with a sound branching process to ensure maximum code
velocity for the Feature Teams while at the same time maintaining
the stability of the Main branch.
Common Code-Sharing Scenario
Sharing common code between projects is a challenge for many
organizations. Tere are three main techniques for sharing code
between projects or solutions in Visual Studio:
File linking
Binary (Assembly) sharing
Source code sharing
As we discuss elsewhere in this article, there are also several
techniques for code isolation:
Team project isolation
Branch isolation
Workspace isolation
Choosing the correct code-sharing strategy for your organiza-
tion likely involves a combination of code-sharing techniques and
isolation techniques.
File Linking: Tis is a feature of Visual Studio (Add Existing
Item) where multiple projects can share a reference to a single
source fle. File linking is better suited for small projects with a
limited number of fles being shared. (Tis resembles fle sharing
in Visual Source Safe.)
With fle linking, theres only one version of the linked source
fle to maintain. Changes made to the linked fle are immediately
received by all projects linking to the fle. Te disadvantage of fle
linking is that changes to the linked fle should be coordinated with
all dependent project teams. Even carefully coordinated changes
might cause breaking changes in dependent projects.
Binary Sharing (Assembly References): With binary
sharing, a Visual Studio solution references common shared
code using assembly references. Here, building or compiling the
dependent solution doesnt also compile the common shared source
code. Compiling dependent projects will be faster using assembly
references rather than project references.
Teams that own the common code have full ownership and
control, which in theory means that the control, versioning and
quality of the product is probably better, and branching and merging
complexities are avoided.
Figure 5 BranchingDemo Team Project, as Viewed in the Source Explorer
Figure 6 A Merge Causes Conicts Due to the Changes Made by Two Teams of the Class1 Class
msdn magazine 80 Team Foundation Server
Because teams reusing the common code dont have access to
the common source code, theyre dependent on the owning team
to add new features and resolve bugs in the common shared code.
The assemblies for the common code can be shared by copy-
ing them to a well-known file share that can be referenced by
dependent projects. Signed assemblies may need to be added to
the Global Assembly Cache. Alternatively, the assemblies can be
copied from the common code Team Proj-
ect to a bin folder under the dependent
projects Main branch.
Source Code Sharing: With source
code sharing in Visual Studio, a dependent
project uses a project reference for the
common shared code. When the solution
is built, all projects are built, including
the common shared code projects. With
complex projects, having many project
references to shared code may signifcantly
increase build time.
In this scenario, the common shared
code is owned and managed by a team in
its own TFS Team Project. To share this
common code, frst branch the code to a
folder with the consuming (dependent)
projects Team Project like this:
Create a folder within the dependent
projects Team Project called Share
(for example, $\Product1\Share).
Branch the Main branch of the
Common Library (for example,
EnterpriseLibrary) to the Share
folder of the dependent Project,
for example branch $\Enterprise
Library\Main to $\Product1\ Share\
EnterpriseLibrary.
Add the appropriate common
code projects to the dependent
projects solution.
Create project references from the de-
pendent project to the existing com-
mon code projects in the solution.
Note: Nested branches arent supported in TFS 2010. A nested branch
error might arise when you try to perform a branch operation that
would cause a new branch to be created (either above or below) an
existing branch in the folder structure (see Figure 3).
Your organization needs to decide whether changes to the com-
mon shared source code should be allowed within each dependent
project. To prevent changes, afer branching from the Common
Library the new branch can be made read-only. All changes to the
common code source must then be made in the Common Library
Team Project and merged into the dependent projects Team Projects.
Alternatively, changes can be made to the shared code source
within a dependent Team Project. Tese changes can be merged
(through reverse integration) back to the Common Library Team
Project. Your organization needs to carefully manage these changes
to avoid incompatibilities that make merging these changes back
to the Common Library dif cult or impossible, perhaps resulting
in multiple copies of the shared code.
Architecture Tooling and Modeling Scenario
In Visual Studio Ultimate, you can create UML and Layer models
that exist in their own separate Visual Studio projects and can con-
tain many packages, dealing with diferent
parts of the solution (see the Architecture
Tooling Guidance at vsarchitectureguide.code-
plex.com and Modeling the Application at
msdn.microsoft.com/library/57b85fsc.aspx).
To explore whether branching and
merging is possible with models, we can
create a simple test environment with three
scenarios, as shown in Figure 4.
We can create a Main branch, with a
solution that contains a model project
with an empty UML class diagram as a
hypothetical stable project. We can then
branch Main to Scenario1, Scenario2 and
Scenario3, then branch each Scenario to a
Dev1 and Dev2 branch representing de-
velopment teams, as shown in Figure 5.
Its obvious that we have no issue with
branching, but can we reverse integrate
(merge) changes in the model?
In Scenario1, the teams make no model
changes, and with Scenerio2 only one of
the two teams expands the models. Te re-
sultant RI from the Development branches
to the associated scenario branch is un-
eventful with the unchanged Scenario1
model and the updated Scenario2 model.
Scenario3 is a more realistic example
where both teams update the model. Dev1
Team creates two classes and Dev2 Team
creates one class.
Te assiduous reader will notice that
both teams created a Class1 class, with
diferent operations.
Figure 8 The Proposed Package-Based
Structure as Seen in Solution View
Figure 9 The P roposed Package-Based
Structure as Seen in UML Model Explorer
Figure 7 Visualizations Spread Across Three Main Files
81 February 2011 msdnmagazine.com
Reverse integrating the frst of the two devel-
opment branches back to the Scenario3 branch
gives the false sense of security that the merge
will be easy. But when the second team merges
changes to the Scenario3 branch, conflicts for
three fles (.classdiagram, .layout and .uml) block
the check-in, as shown in Figure 6.
We could select the options Keep Target Branch
Version or Take Source Branch Version and
answer the question whether merging is possible
with a yes. The result, however, would be a very
unhappy team losing its changes. Te alternative is
to select the Merge Changes in Merge Tool option
for a manual merge, which is impractical, unintui-
tive and error-prone for most of us.
Te branching and merging of architecture models
is therefore possible, but is it recommended? Te prob-
lem with the UML model is that the visualizationsfor
example, the class diagramare spread across three
main fles (.layout, .classdiagram and .uml) as shown in Figure 7.
Te .layout fle defnes the size and positions of the shapes in the
model. Te .uml fle is the master model, and the .classdiagram
fle holds a cache of the content from the .uml fle, which is pres-
ent in the diagram.
Merges are also dif cult, as normal edits in the modeling tools
are validated and ofen augmented by the tool to avoid invalid
states. Such validation doesnt happen in a pure XML merge, which
causes the risk of creating invalid models that might not even open.
If each team makes changes only to their diagrams, and if these
changes represent classes in separate packages, the problem could
be reduced, as most changes would appear in separate fles. Even so,
inevitably there will be some cases where relationships that cross
package boundaries are changed.
In reality, some teams will want to branch when creating new
product iterations, which causes forking of source code, docu-
mentation and models. Models such as the activity, sequence, layer
and class diagram are good examples of models that evolve over
iterations, while the delivery team continues with the mainstream
development and maintenance. Terefore, models may and ofen
will evolve in two or more branches, which means that well
encounter the branching scenario and the ofen-challenging merge
scenario at some point.
All of the current models are good candidates for branching, but
none are conducive to merging. With the prospect of a challenging
and error-prone merge, the recommendation is twofold:
Avoid a merge by defning a solution and model view
that represents classes in separate packages. Te architec-
ture tooling guidance proposes a solution view, shown in
Figure 8, and a model view, shown in Figure 9, based on
packages. Some care must be taken when diagrams have
content from multiple packages, which is possible for Class,
Component and Use Case. In this case, to fully avoid con-
ficts, users must avoid editing the metadata of elements
that belong to the foreign package.
Keep models on a branch that wont be forked, similar to
shared components.
Te fallback is to visually and manually edit the models in one
branch, using the options Keep Target Branch Version or Take
Source Branch Version options as shown in Figure 10.
For example, the models diverge in the two branches as shown
and are merged manually (step 3) by visually comparing the
models and manually updating the model in the top branch. Te
branch with the consolidated model is then reverse-integrated into
Main (step 4) and the other branch with the outdated model is
reverse-integrated (step 5) using Take Target Branch Version
when resolving model conficts.
In summary, theres no good story for automatic model merging
yet. The recommended strategy is to avoid a branch and merge
scenario with the models, or to use the visual and manual model
editing before merging.
Weve now introduced a number of new branching scenarios that
you may encounter in a complex real-world environment. In the
next article in this series, well investigate team projects and team
project collections.
BILL HEYS is a senior consultant with Microsof Americas Consulting Services
in New England. As a Visual Studio ALM Ranger, Heys specializes in custom
application development and Application Lifecycle Management using Visual
Studio. His blog is at blogs.msdn.com/b/billheys.
WILLY-PETER SCHAUB is a solution architect with the Visual Studio ALM
Rangers at the Microsof Canada Development Center. Since the mid-80s hes
been striving for simplicity and maintainability in sofware engineering. His blog
is at blogs.msdn.com/b/willy-peter_schaub.
THANKS to the following technical experts for reviewing this article:
Marcel de Vries, Jens Jacobsen, Bijan Javidi and Alan Wills
Figure 10 A Manu al Model Edit Merge
Resolve Conflict by
Selecting to Use
Target Source, Which
We Created in Step 4
B
r
a
n
c
h
R
e
v
e
r
s
e

I
n
t
e
g
r
a
t
i
o
n
R
e
v
e
r
s
e

I
n
t
e
g
r
a
t
i
o
n
MAIN
DEV-1
DEV ... 2 3 4
5 2
1
Class1
Attributes
Operations
+ Bar()
Class1
Attributes
Operations
+ Foo()
Class2
Attributes
Operations
Theres no good story for
automatic model merging yet.
msdn magazine 82
WI NDOWS WORKFLOW
Securing WF 4
Work ow Services
Windows Workow Foundation (WF) provides a visual
authoring experience for writing software logic. Once software
logic is implemented as a workflow, its executed by hosting the
workfow in a workfow host. A workfow service is a special type
of Web service implemented using a workfow and is made avail-
able to the consumer by hosting it in a WorkfowServiceHost. In
Zulfiqar Ahmed
this article, Ill talk about security options of the diferent workfow
hosts with a particular focus on the workflow services and the
WorkflowServiceHost. Ill explain some key extensibility points
that can be used to extend the workfow services security boundary
to the workfow layer. Ill also discuss the Workfow Security Pack
(WFSP) project and how its collection of activities can be used to
bring end-to-end security to workflow solutions. WF 4, which
is shipped as part of the Microsof .NET Framework 4, provides
an extensible hosting API and comes out-of-the-box with three
diferent hosts with varying capabilities.
WorkowInvoker Tis is the most basic and least capable
host interface, providing a simple API for invoking workfows. A
WorkfowInvoker object only supports a single workfow instance,
passed to it via the constructor or the static Invoke method. All work-
fow execution is guaranteed to be on the same calling thread, so if
calling code is impersonating a particular security context, all the
activities will execute under this impersonated context. Workfow-
Invoker isnt a Workfow Host in the true sense; rather, it encapsulates
a WorkfowApplication-based host and uses a pump-based syn-
chronization context to provide an easy-to-use API with consistent
execution semantics. For example, Exceptions, Transactions and so
on seamlessly fow across the invocation boundary. Tis behavior
simplifes the security, as the security context of the caller is available
throughout the workfow execution and activities can use it in various
security scenarios. For example, Principal-Permission authorization
and Kerberos-delegation work seamlessly with WorkfowInvoker.
This article discusses a prerelease version of the Workow Security
Pack. All information is subject to change.
This article discusses:
Workow host options
Workow services wire security
The OperationContext
Workow services and Windows Identity Foundation
Workow Security Pack Community Technology Preview 1
In-workow authorization
Messaging activities and authenticated messaging
Windows impersonation/delegation
Technologies discussed:
Windows Workow Foundation, Workow Security Pack
Code download available at:
code.msdn.microsoft.com/mag201102Workow
83 February 2011 msdnmagazine.com
WorkowApplication Tis is a slightly more capable host
but still supports only a single instance. Tis host executes work-
fow using the IO threads from the CLR TreadPool. Te security
context of a calling thread isnt copied to the workfow thread, so
even if the workfow client is impersonating, the WF threadwhich
is executing the activitieswont be impersonating. Te security
context of the caller can be fown to the WF thread using a custom
Synchronization context that would forward the call on the same
incoming Async thread, similar to the Synchronization context
used by the WorkfowInvoker:
public class MySyncContext : SynchronizationContext
{
public override void Post(SendOrPostCallback d, object state)
{
d(state);
}
}
WorkowServiceHost Tis is the most comprehensive host,
providing a hosting environment suitable for multiple workfow
instances. Workflow services are a special type of Web services
whose implementation is based on workflows.
WorkfowServiceHost derives from the standard
Windows Communication Foundation (WCF)
ServiceHostBase class, and all the WCF security
concepts apply to WorkfowServiceHost as well.
Messaging activities are the primary interaction
model supported by the WorkflowServiceHost,
along with the WorkfowHostingEndpoint, which
enables the use of WorkfowServiceHost without us-
ing messaging activities. In this article, Ill primarily
focus on the security aspect of messaging activities,
Workfow Services and the WorkfowServiceHost.
For an overview of workfow services technology,
please check out Leon Welickis article, Visual
Design of Workfows with WCF and WF 4, in the
May 2010 issue of MSDN Magazine (msdn.microsoft.com/magazine/ff646977).
Workow Services Wire Security
As workflow services are standard WCF services, wire security
aspects are confgured using the standard WCF binding mechanisms.
A workfow service can be exposed using one or more endpoints
using a particular binding as per the security needs of the service.
A WCF dispatch pipeline will only execute if the incoming message
satisfes the security requirements of the target endpoint. Workfow
logic executes at the end of a dispatch pipeline, so all common WCF
extensibility points are applicable to workfow services as well. For
example, the standard ServiceAuthorizationManager extensibility
point can be used to apply authorization for workfow services as
well. Frameworks like Windows Identity Foundation (WIF) inte-
grate with WCF at the dispatcher level, and these can transparently
be used with workfow services as well. Tere are some threading
http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue
http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue
http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT
http://tempuri.org/IPingService/Ping
http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT/Cancel
Figure 2 Infrastructure Messages Sent to Negotiate
Service Credentials
Figure 1 Send Activity Properties
[ContentProperty("Body")]
public sealed class OperationContextScope : NativeActivity
{
public Activity Body { get; set; }
protected override void Execute(NativeActivityContext context)
{
if (this.Body != null)
{
// Adding an execution property to handle OperationContext
context.Properties.Add(OperationContextScopeProperty.Name,
new OperationContextScopeProperty());
context.ScheduleActivity(this.Body);
}
}
}
Figure 3 A Simple Scope Activity to Add Execution Properties
[DataContract]
class OperationContextScopeProperty : IReceiveMessageCallback,
IExecutionProperty
{
private OperationContext current;
private OperationContext orignal;
public static readonly string Name =
typeof(OperationContextScopeProperty).FullName;
public void OnReceiveMessage(OperationContext operationContext,
ExecutionProperties activityExecutionProperties)
{
current = operationContext;
operationContext.OperationCompleted
+= delegate(object sender, EventArgs e)
{
current = null;
};
}
public void CleanupWorkflowThread()
{
OperationContext.Current = orignal;
}
public void SetupWorkflowThread()
{
orignal = OperationContext.Current;
OperationContext.Current = current;
}
}
Figure 4 ReceiveMessageCallback Implemented
as an Execution Property
msdn magazine 84 Windows Workow
diferences, related to few async points between the WCF and WF
layers, which make certain Thread Local Storage (TLS)-related
scenarios a bit more challenging in the workflow services. For
example, WIF exposes the incoming identity information using the
Tread.CurrentPrincipal and it makes sure to set this correctly for
the code-based services. However, your workfow logic might end
up executing on a diferent thread than the original WCF thread.
If that happens, all TLS-related dataincluding
the Tread.CurrentPrincipalwont be valid,
so its advised not to rely on TLS in your work-
fows. Ill talk about some potential solutions
to this in a later section.
WF 4 also provides a Send activity for calling
other Web services from within a workfow. Te
Send activity can be confgured with a binding
that would be used when calling other services
from within the workfow. Internally, the Send
activity uses the standard WCF ChannelFactory/
Channel API for sending messages, and the confg-
ured binding is used to create this internal channel
factory. Send activity also has a caching layer built
into it thats used for ChannelFactory/Channel
caching. By default, this caching layer is only used
if the endpoint information is specifed directly
using the properties of the Send activity and a
stock binding is chosen, as shown in Figure 1.
As soon as endpoint information is loaded from
the confg fle using the EndpointConfguration-
Name property, the safe caching is disabled and
every execution of Send activity creates a brand-
new ChannelFactory. Secure bindings such as
wsHttpBinding and wsFederationHttpBinding
do quite a lot of work at the channel factory
opening stage, and recreating a channel factory
for each message could be quite expensive. For
example, the default WSHttpBinding is optimized
for performance and security and achieves this
by establishing a secure conversation session that
has an upfront cost, but subsequent messages can
be secured with a much smaller cost. Without
ChannelFactory caching, this optimum behavior
of WSHttpBinding becomes an overhead because
for every business message, four additional infra-
structure messages are sent to negotiate the service
credentials and then to establish a secure conver-
sation session, as shown in Figure 2.
In WF 4, any binding confguration loaded
from the confguration fle (even the default
bindings) is treated as unsafe for caching
by the Send activity, and the ChannelFactory
caching is disabled. This default behavior
can be overridden by forcing unsafe channel
caching, which will reuse the ChannelFactory
for sending messages to the same endpoint.
Send MessageChannelCache service behavior
enables unsafe caching and also allows the confguration for various
Channel and ChannelFactory cache settings, as shown here:
<serviceBehaviors>
<behavior>
<sendMessageChannelCache allowUnsafeCaching=true>
<channelSettings idleTimeout=1:0:0 maxItemsInCache=60/>
<factorySettings idleTimeout=1:0:0 maxItemsInCache=60/>
</sendMessageChannelCache>
</behavior>
</serviceBehaviors>
Where Is My OperationContext?
In traditional code-based services, security
information for the incoming call is avail-
able via the OperationContext.Current. The
WCF dispatcher runtime makes sure to set the
OperationContext on the thread just before
calling the service method, so inside the service
method, security information is accessible
using the OperationContext.Current.
Workfow services add additional complexity
because there are a bunch of async points between
the WCF dispatcher and workfow execution. Any
one of these async points can switch the thread, in
which case workfow logic (activities) would ex-
ecute on a diferent thread from the WCF thread
and OperationContext wouldnt be available
using the OperationContext.Current approach.
In WF 4, thread-agnostic access to Operation-
Context is enabled using a callback mechanism
based on IReceiveMessageCallback and ISend-
MessageCallback. IReceiveMessageCallbacks
are used on the server side, while ISendMessage-
Callbacks give access to the OperationContext
on the client side. On the server side, IReceive-
MessageCallbacks are invoked just afer a message
is received by a Receive activity. To attach these
callbacks to Send and Receive activities, they
must be available as execution properties when
Send/Receive executes. A common approach
for adding execution properties to an activity
is to create a parent scope activity and set the
execution properties as part of the parent activ-
itys execution, as shown in Figure 3.
In the code snippet in Figure 3, when the
OperationContextScope activity executes, it
simply adds an execution property to the
context so that all the child activities can see
this execution property. Send and Receive
activities look for the previously mentioned
callback properties, and if one of these prop-
erties is found, its invoked at the correct stage
of message processing, giving you access to the
OperationContext. In this example, any Receive
activity that would be part of the same scope
sees the OperationContextScopeProperty and
executes the callback passing in the Operation-
Context value (see Figure 4).
Figure 5 Workow Security
Pack Activities
Figure 6 Authenticated Messaging
Using a UserName Token
Figure 7 Fine-Grained Control of
SAML Token Acquisition and Usage
85 February 2011 msdnmagazine.com
OperationContextScopeProperty simply captures and stores
the currently active OperationContext and later on sets it on
the correct WF thread using the WF TLS mechanism. The
IExecutionProperty interface has Setup/CleanUpWorkfowTread
methods, which are called before and afer executing every WF
work item (activity) and give the ability to set various TLS-related
properties on the selected WF thread, OperationContext being
one example in this case.
OperationContextScope is an example
of a custom activity that leverages the WF
4 extensibility to enable thread-agnostic
access to the WCF OperationContext for
all in-scope child activities.
Workow Services and WIF
WIF provides a rich API and object
model to claim-enable WCF services and
ASP.NET applications. WIF integrates
with WCF at the host level, so most of
the WIF features work with Workflow
Services as well. Please check my blog
post bit.ly/a6pWgA for additional details
on integrating WIF with Workflow
Services. Te out-of-box integration works fne for basic scenarios,
while additional rich scenarios can be enabled using the activities
from WFSP.
Introducing WFSP CTP 1
WFSP Community Technology Preview (CTP) 1 provides a collec-
tion of activities and associated WCF behavior to enable key security
scenarios in WF 4. WFSP leverages the ISend/IReceiveMessage-
Callback extensibility model to implement many of its features.
CTP 1 of WFSP was released on CodePlex in July 2010 and can be
downloaded from wf.codeplex.com/releases/view/48114.
WFSP activities, shown in Figure 5, blend nicely with the rest
of the WF and provide powerful constructs to bring integrated
security in workfow solutions.
In-Workow Authorization
In Workflow Services, you can use the standard WCF Service-
AuthorizationManager extensibility to enforce authorization, and
that feature works exactly the same as in code-based services. How-
ever, in some scenarios (for example, where authorization data is
part of workfow), youd like to delay the authorization decision until
actual workfow execution. PrincipalPermissionScope is a server-
side activity that brings the CLR PrincipalPermission authorization
feature to the workfows. Any child activity placed inside the scope will
only execute if the permission demand was successful. Tis activity
looks for the identity information in the incoming WCF security con-
text accessed from the OperationContext.
PrincipalPermissionScope is implemented
using the same IReceiveMessageCallback
mechanism mentioned earlier in this article.
Te actual PrincipalPermission demand
is enforced against an IPrincipal object
based on the value of ServiceAuthorization-
Behavior.Principal PermissionMode. Tis
extensibility feature enables Principal-
PermissionScope to work with an ASP.NET
Role Provider as well as a custom
IPrincipal implementation produced by
a custom IAuthorizationPolicy. Check
out msdn.microsoft.com/library/aa702542 for
details on how to confgure ASP.NET Role
Provider with a WCF service.
[Designer(typeof(GetX509SecurityTokenDesigner))]
public class GetX509SecurityToken : GetSecurityToken
{
public GetX509SecurityToken()
{
FindType = X509FindType.FindBySubjectName;
StoreLocation = StoreLocation.CurrentUser;
StoreName = StoreName.My;
}
public InArgument<X509Certificate2> Certificate { get; set; }
public X509FindType FindType { get; set; }
public StoreLocation StoreLocation { get; set; }
public InArgument<string> FindValue { get; set; }
public StoreName StoreName { get; set; }
protected override void Execute(NativeActivityContext context)
{
X509Certificate2 targetCert = null;
if (this.Certificate != null)
targetCert = this.Certificate.Get(context);
if (targetCert == null)
{
var store = new X509Store(StoreName, StoreLocation);
try
{
store.Open(OpenFlags.ReadOnly);
var col = store.Certificates.Find(FindType, FindValue.Get(context), false);
if (col.Count > 0)
targetCert = col[0];//Use first certificate mathing the search criteria
}
finally
{
if (store != null)
store.Close();
}
}
if (targetCert == null)
throw new InvalidOperationException(
"No certificate found using the specified find criteria.");
// Enlist the token as a flow token
base.EnlistSecurityToken(context, new X509SecurityToken(targetCert));
}
}
Figure 8 WFSP Extensibility: Implementing Additional Token Types
Figure 9 TokenFlowScope with a Custom
GetToken Activity
As workow services are
standard WCF services, wire
security aspects are congured
using the standard WCF binding
mechanisms.
msdn magazine 86 Windows Workow
Messaging Activities and Authenticated Messaging
Send activity provides the primary way of consuming Web services
from within workfows. In most real-world scenarios, these back-end
services are secured and require authentication before doing any work.
In standard code-based services, credential information is specifed
using the ClientCredential property exposed on a ChannelFactory
and a ClientBase<T> derived proxy class. Using this property, a
client can specify the credential it wishes to use before calling the ser-
vice. Unfortunately, Send activity, which wraps the ChannelFactory,
doesnt expose ClientCredential in WF 4, so some of the scenarios
that require explicit credential specification arent possible with
out-of-box Send activity. Note that Send activity does pick the end-
point behavior confguration from the confg fle, so you can create a
custom endpoint behavior to specify these credentials.
A typical example that requires explicit credentials is calling a ser-
vice configured to require a UserName/Password. As the Client-
Credential property isnt exposed on the Send activity, theres no
way to specify a UserName/Password. Lets see how GetUser-
NameSecurityToken activity from WFSP provides a solution to
this and other related scenarios.
In Figure 6, Ping activity is generated by the Add Service Reference
wizard and is confgured to call a service thats secured to require User-
Name authentication, as shown in following binding confguration:
<wsHttpBinding>
<binding name="singleShotUserName">
<security mode="Message">
<message clientCredentialType="UserName" establishSecurityContext
="false" />
</security>
</binding>
</wsHttpBinding>
In the preceding workflow, GetUserName-
SecurityToken creates a UserNameSecurityToken
based on the supplied UserName/Password and enlists
it with the ambient SecurityTokenHandle provided
by the TokenFlowScope activity. Workfow Security
Pack applies security at the SecurityToken level as
opposed to the ChannelFactory /ClientBase<T>
approach of applying security at the credential lev-
el. In standard WCF, credentials are used to create
security tokens, but WFSP uses security tokens
directly and taps into the WCF security layer at the
token level rather than the credentials level.
TokenFlowScope is the key activity that enables authenticated
messaging and other interesting scenarios. This activity, along
with the WorkflowClientCredentials endpoint behavior, flows
the enlisted tokens from the workfow layer to the WCF security
layer, where theyre attached with the outgoing message as per the
binding requirements of the endpoint. TokenFlowScope requires
a custom ClientCredential behavior (WorkfowClientCredentials)
to be confgured, as shown in the following confguration snippet:
<behavior>
<!--This custom clientCredentials enables the credential flow from
workflow data model into WCF security layer. -->
<clientCredentials
type=Microsoft.Security.Activities.WorkflowClientCredentials,
Microsoft.Security.Activities, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35>
</clientCredentials>
</behavior>
WFSP follows this exact model when calling a service that requires
a token from a Security Token Service (STS), as shown in Figure 7.
In Figure 7, GetSamlSecurityToken goes to an issuer and
acquires a SAML token thats then enlisted with the ambient
handle provided by the TokenFlowScope activity. Tis enlistment
makes this token available to any Send activity living in the same
scope and requiring a SAML token. Te model is extensible, and
GetSamlSecurityToken can itself use an already enlisted token
while acquiring a SAML token, for example, if the STS requires a
UserName token to return a SAML token and if theres already a
valid UserName token enlisted in the scope. GetSamlSecurity-
Token, when confgured with WorkfowClientCredentials behavior,
would use this token when requesting a SAML token.
Out-of-box WFSP only supports UserName and SAML token
types; however, other token types can be enabled by inheriting from
Figure 10 Creating an ActAs Token
Figure 11 End-to-End Claims-Based Delegation Flow
Workflow Service
4: Call + Token T2
3
:

G
e
t

T
o
k
e
n

f
o
r

B
a
c
k
-
E
n
d

A
c
t
i
n
g

a
s

T
1
2: Call + Token T1
1: Get Token for Workflow Service
Back-End WCF Service
STS
Windows Identity Foundation
provides a rich API and object
model to claim-enable
WCF services and ASP.NET
applications.
87 February 2011 msdnmagazine.com
the GetSecurityToken class as shown in the code
snippet in Figure 8, which implements an
activity to create an X509-based token.
GetX509SecurityToken creates an X509-
Security token based on a certificate and
enlists it with the SecurityTokenHandle as a
fow token that can then be used to call a ser-
vice requiring a certifcate for authentication.
Figure 9 shows GetX509SecurityToken in use
with a custom activity designer.
Claims-Based Delegation
Claims-based delegation is another useful
feature enabled by WFSP. Claims-based delega-
tion is ofen more desirable for workfow ser-
vices, as these services primarily implement an
orchestration/business process calling multiple
back-end services. Additionally, access to a call-
ers identity in those back-end services is ofen
required to enable fne-grained authorization
decisions. WFSP leverages the ActAs function-
ality of WS-Trust 1.4 to enable any token type
to be used as an ActAs token. By default, all the
GetToken activities create a token and enlist it
as a fow tokenhowever, all of these activities
also have a flag known as IsActAsToken, as
shown in Figure 10.
When this fag is checked, the token-creation
logic stays the same, but the created token T1 is
enlisted as an ActAs token rather than a fow
token. Tere can be only one ActAs token per
scope, and its consumed by GetSamlSecuri-
tyToken activity when requesting a SAML to-
ken. When GetSamlSecurityToken executes,
the active ActAs token is picked up and is sent
as part of a token-issuance request generated
by the GetSamlSecurityToken activity. Te returned token T2 would
contain claims from both the authentication token as well as the
ActAs token. Finally, any Send activity executing inside this scope
can use this T2 token when calling a back-end service that would
see both the identities in its security context.
GetBootstrapToken activity is used in middle-tier scenarios to
enable end-to-end claims-based delegation. As opposed to Get-
Token activities, this activity simply reads the incoming token and
enlists it as an ActAs token rather than creating a new token and
then enlisting it. GetBootstrapToken activity enables a workfow
service to use the identity of the incoming caller, in addition to its
own identity, when calling back-end services, as shown in Figure 11.
In Step 3 of Figure 11, workfow service uses WFSP activities to
read the incoming bootstrap token, acquires a new token acting
as the bootstrap token identity and then fows both identities to a
back-end server. Figure 12 shows the workfow thats used by this
workfow service.
In the workfow shown in Figure 12, GetBootstrap activity is placed
inside an Operation ContextScope to guarantee thread-agnostic
access to an OperationContext when this
activity executes. GetSamlSecurityToken uses
the ActAs token produced in the previous step
by the GetBootstrapToken activity and then,
finally, Echo activity calls the back-end
service with a final SAML token produced by
the GetSamlSecurityToken activity.
Windows Impersonation/Delegation
ImpersonatingReceiveScope is another server-
side activity that brings Windows impersonation
and delegation to the workfow world. When
this activity executes, it looks for a Windows-
Identity inside the incoming security context.
If the incoming message produces a Windows-
Identity, all the child activities that are part of
the body will execute inside this impersonated
scope. Impersonating ReceiveScope uses the
Workfow TLS mechanism, mentioned earlier
in this article, to impersonate the identity on the
WF thread just before executing a work item.
Impersonation is reverted when the WF work
item completes execution.
Failing to find a valid WindowsIdentity in
the incoming security context, Impersonating-
ReceiveScope looks for a UPN claimeither in
a WIF identity (Thread.CurrentPrincipal) or
in the traditional WCF ClaimsSetand uses
it to create a WindowsToken using the S4U
features of Kerberos. To transform a UPN
claim to a Windows token, Impersonating-
ReceiveScope relies on Claims to Windows
Token Service, which is part of the WIF
runtime. This service must be installed and
running for the claim-to-token transforma-
tion to be successful.
Figure 13 shows a typical use of ImpersonatingReceiveScope activity.
End-to-End Security
From the outside, workfow services are standard WCF services,
and as such, most of the WCF security options are applicable
to workflow services as well. WF 4 introduced a couple of key
extensibility points that can be used to further extend the workfow
services security boundary to the workfow layer. WFSP provides
a collection of activities that use these extensibility points to bring
end-to-end security to WF 4.
ZULFIQAR AHMED is a senior consultant on the Premier Support for Developers
team and is the original author of the Workflow Security Pack project. He
maintains a blog at zamd.net, where he covers topics ranging from Windows
Communication Foundation, Windows Workfow Foundation and claims-based
security to general Microsof .NET Framework stuf.
THANKS to the following technical expert for reviewing this article:
Dave Clife
Figure 12 Claims-Based
Delegation Workow
Figure 13 ImpersonatingRecieve-
Scope in Action
msdn magazine 88
Te next step in EVM is to estimate how much of the overall test
resource allotment, or budget, is associated with each subtask. Tis
is called the planned value (PV) for each subtask.
The example in Figure 2 assumes that you have a total test
budget of 350 units. PV units are most ofen measured in dollars
(or Euros or rubles and so on). The absolute magnitude of cost
units is unimportant, so the 350 total planned value in our example
could represent $350 or $350,000. Besides monetary units such as
dollars, the units of PV can also be arbitrary units that measure
the cost in some way.
Tere are no magic formulas to determine the subtask PV, but
its important to note that the accuracy of the schedule progress
metrics produced by EVM depends entirely on the accuracy of
your initial PV metrics. In Figure 2, you can see the PV estimates
for subtasks A, B, C, D and E are 50, 60, 90, 80 and 70 respectively.
Afer estimating PV, the next step in EVM is to estimate how
long each subtask will take, and then use these estimates to deter-
mine the fnish time for each subtask. In Figure 2, I determined
(using historical data, or previous experience, or some quantitative
technique) that subtasks A, B, C, D and E are estimated to take
1, 2, 3, 1 and 2 days each. In this example, the units of time are days,
but you can use hours or weeks or any measure as long as youre
consistent throughout the EVM analysis.
We start at time = 0, so if subtask A is estimated to take 1 day,
it will finish at day 1. Subtask B would then begin at day 1 and
require 2 days, ending at day 3. Notice that subtask E cannot begin
until subtasks C and D both fnish, which would be on day 6 (the
larger of the fnish times for C and D), and so would end at day 8.
Measuring Test Effort Progress with EVM
In many sofware development environments, an important part of
the overall sofware-testing efort is having the ability to measure the
progress of the test efort. One technique for doing this is a project
management technique called Earned Value Management (EVM).
EVM is a simple quantitative technique that can be used to mea-
sure the schedule progressand optionally the budget progressof
any type of project, including a sofware-testing efort or some part
of the overall efort. EVM had its origins in a 1962 initiative by the
U.S. Department of Defense called PERT/Cost. Although EVM is
simple to use and can be applied to test eforts of any size, based
on my experience many sofware engineers incorrectly believe that
EVM is suitable for use only with large sofware development eforts.
In this months Test Run column I explain what EVM is, walk you
through an example of using EVM to measure test-efort progress,
and describe when to use EVM and when not to use it.
Preparing Earned Value Management
Te best way to understand EVM is to walk through a concrete
example. Te frst step in EVM is to break down the part of the
testing efort you want to monitor into smaller tasks. In standard
project management terminology these smaller tasks are usually
called work packages, but in a sofware development environment,
ofen theyre simply called subtasks.
Let me emphasize up front that breaking down a sofware testing
efort, or any project for that matter, typically is the most dif cult
part of the EVM process.
Now lets assume that you break down your test effort into five
subtasks, labeled A through E, as shown in Figure 1. The level
of detail, or granularity, you break your overall testing effort
down to depends on many factors. As a general rule of thumb,
in a software-testing environment, individual subtasks are often
scoped so that each subtask requires roughly between four and
40 hours to complete.
Te topology of the diagram in Figure 1 indicates that testing
subtask A must be completed before B starts, and that subtasks C
and D must both be completed before subtask E can start.
TEST RUN JAMES MCCAFFREY
Figure 1 Mapping Subtasks for EVM
Subtask A Subtask B Subtask E
Subtask C
Subtask D
Subtask Planned Value Duration (days) Finish (days)
A 50 1 1
B 60 2 3
C 90 3 6
D 80 1 4
E 70 2 8
Figure 2 Scheduling Subtasks
Break down the part of the
testing effort you want to
monitor into smaller tasks.
89 February 2011 msdnmagazine.com
Once youve determined what your sofware test efort subtasks
are, and estimated their PV, durations and fnish times, the next step
is to create a table of cumulative PVs. You begin by constructing a
table like the one shown in Figure 3. Te lefmost column marks
the end of each unit of time (in this example, days 1 through 8). Te
second column is the cumulative PV at the end of each day, which
can be determined from the previous table of PV data.
At the end of day 1, subtask A should be completed and so the
cumulative PV should be 50, the PV for A. At the end of day 2, no
new subtasks are expected to be fnished so the cumulative PV
is still 50. At the end of day 3, subtask B should now be fnished
and so the cumulative PV should be 50 for subtask A plus 60 for
subtask B = 110. In the same way the cumulative PVs at the end of
days 4 through 8 can be determined.
Measuring Test Schedule Progress
Lets suppose that your test efort unfolds as shown in the third
column in the table in Figure 3. Tese activities represent what
actually happens as opposed to what you expect to happen. Te
diference between what you had planned to accomplish (your PV)
and what you actually accomplished is your earned value (EV).
So, at the end of day 1, subtask A started but did not fnish as
scheduled. Terefore the cumulative EV in column 4 is 0. At the
end of day 2, subtask A does in fact fnish and so I earn 50 (the PV
associated with A), and place that value in column 4. At the end of
day 3, subtask B fnishes and so the cumulative EV is 50 + 60 = 110.
But at the end of day 4, no new subtasks fnish and so the cumulative
EV is still 110. At the end of each day, or whatever time unit youre
using, you update the cumulative EV column.
Your test efort schedule progress is easily read from the table in
Figure 3. If the cumulative EV is less than the cumulative PV, then
youre behind schedule. If the cumulative EV is exactly equal to the
cumulative PV, then youre on schedule. And if the cumulative EV
is greater than the cumulative PV, then youre ahead of schedule
(which, by the way, is not necessarily always a good thing).
EVM typically uses two specifc metrics to quantify how much
ahead, behind or on schedule your test effort is. The so-called
schedule variance (SV) at any given point in time is simply the
cumulative EV minus the cumulative PV. For example, in Figure
3, at the end of day 4, SV = 110 190 = -80 indicating the test efort is
80 cost units (typically dollars) of PV behind schedule. A negative
SV indicates a project is behind schedule and positive SV indicates
a project is ahead of schedule.
Because the absolute magnitude of SV depends on the units of PV,
an alternative metric called the schedule performance index (SPI) is
ofen used instead of SV. SPI is cumulative EV divided by PV. In my
example, at the end of day 4, the SPI is 110 / 190 = 0.58.
Tis can be interpreted to mean that I have only earned 58 percent
of my PVin other words, Im 42 percent behind my scheduled PV.
SPI values less than 1.00 mean the test efort is behind schedule,
an SPI value of 1.00 means the test efort is exactly on schedule, and
SPI values greater than 1.00 mean the test efort is ahead of schedule.
Wrapping Up
As youve seen in this column, monitoring software-test effort
schedule progress with EVM is easy. However, as with any quan-
titative technique, your results are only as good as your initial
datain this case the PVs associated with each test efort subtask.
EVM is a dynamic activity and you should revise your estimates
as your test efort unfolds.
In the introduction to this column I mentioned that EVM can
be used to measure both schedule progress and budget progress.
Measuring schedule progress as Ive explained here is a prerequi-
site for measuring budget progress. Measuring budget progress
requires that you actively monitor how much of your resources you
spend at the end of each time unit. Tis is typically more dif cult
than measuring your work progress, so measuring budget progress
with EVM is ofen only used on larger sofware projects and will
be the subject of a future Test Run column.
Te EVM approach for measuring test efort schedule progress Ive
presented here, which essentially is a paper-and-pencil technique,
is well suited for small projects and projects being developed in an
Agile environment. When developing large sofware projects, sofware
tools are usually needed to manage the complexity introduced by the
existence of hundreds or even thousands of test efort subtasks.
DR. JAMES MCCAFFREY works for Volt Information Sciences Inc., where he man-
ages technical training for sofware engineers working at the Microsof Redmond,
Wash., campus. Hes worked on several Microsof products, including Internet
Explorer and MSN Search. Dr. McCafrey is the author of .NET Test Automation
Recipes (Apress, 2006) and can be reached at jammc@microsof.com.
THANKS to the following Microsoft technical expert for reviewing this article:
James Oker
Day Cum PV Actual Activity Cum EV
1 50 A has started (but has not yet nished) 0
2 50 A has nished, B has started 50
3 110 B has nished, C and D have started 110
4 190 (no change) 110
5 190 (no change) 110
6 280 Both C and D have nished, E has started 280
7 280 (no change) 280
8 350 E has nished 280
Figure 3 Schedule Progress with Cumulative PV
There are no magic formulas to
determine subtask planned value.
As with any quantitative
technique, your results are only
as good as your initial data.
.QRZ
LWDOO
1housands of oode samples
0ver 30,000 artioles
Praotioal answers in aotive forums
MlC/Miorosoft

visual C++

, visual
C#

, visual Basio

.NL1, A3P.NL1, 3L
3erver

, windows

Phone, and more!


uiokAnswers
7.5 million members
3tart your lRLL membership 10UA!
70
:HYHJRWDOOWKHDQVZHUV
0
o
t

a

d
e
v

s
l
t
e
o
r

b
l
o
g
7

1
o
l
n

u
s
:
l
a
k
e
q
u
l
n
c
y
.
c
o
m
/
p
u
b
l
l
s
h
e
r
s
Untitled-1 1 1/11/11 11:44 AM
91 February 2011
I even toyed around with reducing the pro-
gram to just a Play button by implementing a
voice-activation feature! The program would
record continuously and only save the data
when it contained some sounds. But this seemed
like a devilishly difficult job in differentiating
background sounds from real voice data with-
out introducing some kind of manual threshold
setting. I abandoned the single-button design.
My original plan was fne for one memo, but
not for multiple memos. I then thought that the
program would maintain a single audio fle and
tack each new memo on the end of the previous
memos. Because its all just one big file, the
Play button would play back all the memos in
sequence. Of course, the program cant let this fle
grow indefnitely, so this design defnitely needs
a Delete button that wipes out the entire fle and,
consequently, all memos.
No, this wasnt good. I really needed to maintain
separate fles for each memo and allow these memos
to be deleted individually. But that implied some way to present all the
separate fles to the user for playback and deletion, and all of a sudden
the program got much more complex. I defnitely needed a ListBox,
and some way to identify each memo to the user, perhaps with user-
supplied keywords orhorrors upon horrorsan actual fle name.
No, no, no, not that! I glanced over at my telephone answering
machine. Each call or memo is recorded separately, but theyre
numbered on a simple display. Te Play button is complemented
with Previous and Next transport buttons to go to the previous
call or next call. As each memo or call is deleted, however, they
Sound Recording in Windows Phone 7
In one of the very frst print advertisements for
the introduction of the Macintosh in 1984, Apple
touted the design of its mouse with an exception-
ally compelling observation: Some mice have
two buttons. Macintosh has one. So its extremely
dif cult to push the wrong button.
Tis isnt entirely true, of course. Overloading a
single button with multiple functions can be just
as confusing as multiple buttons. But the impos-
sibility of pushing the wrong button is certainly a
persuasive argument for simplicity in UI design.
Stripping down the UI to essentials is even more
important when programming for a smartphone.
Phones arent very large. Tey simply cant have a lot
of buttons, and the fngers that push these buttons
are not as accurate as a mouse. Too many buttons
means that its easier than ever to push the wrong one.
On the minus side, limiting a UI ofen limits the
functionality of the program, so deciding where
to draw the line can be a real struggle. Life is full
of compromises.
Design Evolution
I thought it would be fun to write a Windows Phone 7 program that
allows recording short vocal memos, such as Remember to pick up
the dry cleaning and Had a great idea for a movie: Boy meets girl.
Such a program is useful, of course, and provides yet another
excuse to show off our new Windows Phones by using them in
public places. More importantly for myself, I thought it would be
a great opportunity to get some hands-on experience using the
sound recording and playback classes supported by the phone.
However, the program design turned out to be more problem-
atic than I had anticipated. Even before Id written a single line of
code, the program went through several iterations of design and
redesign in my head.
At frst, I thought it would be fne to have just two buttons labeled
Record and Play, both of which functioned as toggles. Press the
Record button to start recording and press it again to stop. Te
program saves the audio data in isolated storage. Press the Play
button to play it back. Each press of the Record button replaces
the previous memo so the program doesnt need a Delete button.
UI FRONTIERS CHARLES PETZOLD
Code download available at code.msdn.microsoft.com/mag201102UIFrontiers.
Figure 1 The Initial SpeakMemo
Screen
Phones arent very large. They
simply cant have a lot of buttons.
msdn magazine 92 UI Frontiers
are renumbered. I knew I didnt want to number the memos,
but I could take advantage of the larger display on the phone to
show more detail about each one, including the record date, the
duration and the fle size.
The real breakthrough came when I realized I could put the
ListBox on the programs main screen and use it not only for selec-
tion, but for playback as well.
Using the Program
My final design was, of course, a compromise between ultimate
simplicity and a complete memo-management system. Te down-
loadable SpeakMemo project is written for Silverlight for Windows
Phone and requires the Windows Phone 7 Development Tools. You
can run the program on the phone emulator, and it will appear to be
working fne, but it wont actually record or play back any sounds.
Te frst time you run the SpeakMemo program, it displays the
screen shown in Figure 1.
One button! Or, at least one enabled button on a fairly uncluttered
screen. Te button shows how much space exists in isolated storage
and how that corresponds with a recorded sound file. (No, the
program will not allow you to record a memo 17 hours in length!)
Press the Record button and it changes to a fashing red display
with an updating duration indicator, as shown in Figure 2.
Press the Record button again, and the recorded memo shows
up on the screen with the date and time, duration, storage space
and Play button, as shown in Figure 3.
Of course, you can press the Play button to play it back, and the
button toggles between Play and Pause modes.
It might not be so obvious with only one memo, but the recorded
memos are stored in a ListBox in reverse chronological order as
shown in Figure 4, so as you accumulate many of them, you can
scroll through and play them individually.
One of the powerful features of Silverlight is the DataTemplate
that lets you define the appearance of items in a ListBox. This
DataTemplate can include other controls, such as buttons. I was
pleased to come up with a practical application of putting a Button
in a DataTemplate.
You can also manage the collected memos by deleting individual
ones. When a memo is selected, the Delete button is enabled. Per-
haps inspired by putting a Button in a DataTemplate, I performed
another Silverlight trick by putting two additional buttons inside
the Delete button. Tese buttons become visible when you press
Delete, and they perform the traditional confrmation function,
as shown in Figure 5.
Playing a memo causes it to be selected, but an item is not played
when you select it by pressing on the area to the right of the Play
button. Te program lets you play one memo, record another and
delete still another all at the same time.
The Phone and Sound
At one time Windows Phone 7 was supposed to have some of the
speech recognition and synthesis support found in the Microsof
.NET Framework System.Speech namespaces. Perhaps youll see
that support in the future.
Until then, you can capture sound from the phones microphone
and play it back through the phones speaker using classes in the
Microsoft.Xna.Framework.Audio namespace. These are XNA
classes, but you can also use them in Silverlight programs. To use
XNA classes in a Silverlight project, simply add a reference to
Figure 5 Conrming a Delete Figure 4 The SpeakMemo
ListBox
Figure 3 SpeakMemo with
One Memo
Figure 2 SpeakMemo While
Recording
One button! Or, at least one
enabled button on a fairly
uncluttered screen.
93 February 2011 msdnmagazine.com
Microsoft.Xna.Framework.dll to the projects references and
ignore the warning message.
Te classes in the Microsof.Xna.Framework.Audio namespace
are entirely separate from those in the Microsoft.Xna.Frame-
work.Media namespace. Te Media namespace contains classes for
playing music from the phones music library, which are compressed
audio fles in MP3 or WMA format that become objects of type
Song. I show how to access the music library in Chapter 18 of my
book, Programming Windows Phone 7 (Microsof Press, 2010),
which can be downloaded for free from bit.ly/dr0Hdz. In a blog
entry on my Web site, I also demonstrate how to play MP3 or WMA
fles that are stored within the program itself, or which are down-
loadable over the Internet (bit.ly/ea73Fz).
In contrast, classes in the Microsoft.Xna.Framework.Audio
namespace work with uncompressed audio data in the standard
PCM format, which is the same method used for audio CDs and
Windows WAV fles. With PCM, the analog sound amplitude is
sampled at a uniform rate (usually in the range of 8,000 to 48,000
samples per second) and each sample is usually stored as an 8-bit
or 16-bit value. The storage required for a particular sound is
the product of the duration in seconds, the sample rate and the
number of bytes per sample (multiply by two for stereo).
If you need speech-recognition support in your Windows Phone
7 application you must provide it yourself, most likely via a Web
service. Similarly, a program that requires converting text to speech
will probably use a Web service, or wait until the phone provides
that support. Te Microsof Translator app for Windows Phone does
this using the Microsoft Translator service (microsofttranslator.com).
Te code and documentation for the Translator Starter Kit is being
released on MSDN (msdn.microsoft.com/library/gg521144(VS.92).aspx) and
AppHub (create.msdn.com/education/catalog/sample/translatorstarterkit).
When using XNA audio services, a Silverlight program must call
the static FrameworkDispatcher.Update method at approximately
the same rate as the video refresh rate, which on Windows Phone
7 is approximately 30 times a second. Teres a description of how
to do this in the article Enable XNA Framework Events in
Windows Phone Applications within the XNA online docu-
mentation (msdn.microsoft.com/library/ff842408). In SpeakMemo, the
XnaFrameworkDispatcherService class handles this job. Tis class
is instantiated in the App.xaml fle.
Sound Recording
To record sound through the phones microphone, you use the
Microphone class. Youll probably create an instance of this class
with the static Default property:
Microphone microphone = Microphone.Default;
Alternatively, the static All property provides a collection of
Microphone objects, but then youll probably want to present the
list to the user to select one.
Te sample rate is fxed, cannot be changed and is reported by the
SampleRate property to be 16,000 samples per second. According
to the Nyquist sample theorem, this is suitable for recording sounds
up to 8,000 Hz in frequency. Tis is fne for voice, but dont expect
great results with music. Each sample is 2 bytes wide and monaural,
which means that each second of recorded sound requires 32,000
bytes, and each minute is 1.9MB.
Microphone data is delivered to your program in bufers that
are simply byte arrays. Youll install a handler for the BuferReader
event and then call Start to start recording. When the Microphone
object fres the BuferReady event, your code calls GetData with
a byte array. On return from GetData, the bufer has been flled
with PCM data. When your program wants to stop recording,
call GetData once more to get the last partial bufer. Te method
returns the number of bytes transferred to the array. Ten call Stop.
Te only option that Microphone allows you is specifying the
byte size of the buffer that you pass to GetData. The BufferSize
property is a TimeSpan value that must be between 100 ms and
1,000 ms (one second) in increments of 10 ms. In SpeakMemo, I
lef it at the default value of 1,000.
For your convenience, the Microphone class has two methods
to convert between buffer sizes and time. Unfortunately these
methods are a little confusing because the names refer to sample.
The GetSampleDuration method basically divides a byte size
by 32,000 and returns a TimeSpan indicating that many sec-
onds. GetSampleSizeInBytes multiplies a TimeSpan duration in
seconds by 32,000.
When SpeakMemo is recording, it accumulates multiple 32,000-
byte bufers in a generic List collection. When recording stops, the
program saves all the individual bufers to a fle in isolated storage.
Once I decided that I wouldnt include a key-word feature to
identify memos, I wanted the fle to contain only the PCM data
and not any supplementary information. However, I was quite
startled to realize that the IsolatedStorageFile class in Silverlight
for Windows Phone does not support the methods for accessing
the fle creation time or last write time, and I felt this information
was crucial from the users perspective.
Tis meant that the fle name itself would have to include the
date and time. I frst tried creating a fle name from a DateTime
object using the s and u formatting options, but that didnt work.
(Why it doesnt work Ill leave as a simple exercise for the reader.)
I then fabricated my own fle name string by piecing the various
components of the date and time together.
The program lets you play one
memo, record another and delete
still another all at the same time.
A program that requires
converting text to speech will
probably use a Web service.
msdn magazine 94 UI Frontiers
XNA Sound Playback
Te Microsof.Xna.Framework.Audio namespace lets you play back
pre-recorded sounds using the related SoundEffect and Sound-
EfectInstance classes, whose names surely betray their common
function in the context of an XNA game! But the static Sound-
Efect.FromStream method requires a Stream object referencing
a standard Windows WAV fle complete with RIFF header, and I
didnt want to bother with fle formats.
For working with raw PCM data rather than WAV fles, youll
instead want to use the DynamicSoundEffectInstance class,
which derives from SoundEfectInstance. Tis class is ideal for the
data generated from the Microphone class or for programs that
dynamically create their own waveform data, such as music syn-
thesizer programs.
The DynamicSoundEffectInstance constructor requires a
sample rate and a number of channels; if youre using this class
with data generated from the microphone, obviously youll want
to keep it consistent:
DynamicSoundEffectInstance playback =
new DynamicSoundEffectInstance(
microphone.SampleRate, AudioChannels.Mono);
On the other hand, if you want the playback to sound like a
fast-talking chipmunk, simply multiply that frst argument by two.
DynamicSoundEfectInstance expects data to have a 16-bit sample
size. The class has Play, Pause, Resume and Stop methods to
control the playback, and a State property indicates the current
state. Te class works somewhat the opposite of Microphone: It
fres a BuferNeeded event when it requires a new bufer. Your job
is to fll up a bufer with PCM data and call SubmitBufer.
To avoid audible gaps in the sound, in the general case youll want
to maintain a queue of bufers in the DynamicSoundEfectInstance
class and submit a new bufer while the previous bufer is still play-
ing. Te class helps out with a PendingBuferCount property that
indicates the number of bufers in the queue. Te BuferNeeded
event is fred when the PendingBuferCount changes and is less
than or equal to two.
However, if you just need to play an entire chunk of PCM
data, its possible to call SubmitBufer without bothering with the
Bufer Needed event. At frst, this was how I was using the class in
the SpeakMemo program, but I discovered it wasnt possible to
determine when the buffer had completed playing. There is no
state changed event, and even if there were, DynamicSound-
EfectInstance doesnt switch from the Play state to the Stop state
when fnished with the bufer. Its still expecting more bufers. Not
knowing this information prevented the program from correctly
toggling the visuals of the Play/Pause button.
I ended up handling the BufferNeeded event, but only to take
the opportunity to check the PendingBufferCount property.
When PendingBufferCount gets down to zero, the buffer has
completed playback.
Storage Issues
SpeakMemo stores recorded memos in isolated storage. Concep-
tually isolated storage is private to the application, but physically
its part of a total storage area thats analogous to the hard drive
of a desktop computer. All the application executables are stored
there, as well as the phones photo library, music library, video
library and much more. Te hardware specifcation for Windows
Phone 7 requires the phone to have at least 8GB of fash memory
for this storage area, and the phone itself will alert the user when
the storage is getting low.
Storing the memo files was not my big concern. I was more
worried about the programs heap. Aside from the fash memory
storage, the Windows Phone 7 hardware specifcation also requires
256MB of RAM. Tis is the memory that an application occupies
when its running, and which provides the programs local heap. My
experimentations revealed that SpeakMemo could allocate an array
up to 90MB in size before it raised an out-of-memory exception. Tis
is equivalent to about 47 minutes of sound from the microphone.
Tis doesnt mean that a Windows Phone 7 program is necessarily
limited to 47 minutes of recording time. But a program that wants
to record that much continuous sound must progressively save buf-
fers to isolated storage to free up memory, and then load the fle
incrementally when playing it back. Tis was not how SpeakMemo
was structured. Instead, the program saved and loaded entire fles,
and I didnt feel inclined to abandon that much simpler structure.
For that reason, I simply set a 10-minute maximum on the memo
duration. Once a recording reaches that length, its simply stopped
and saved (which itself requires several seconds). To keep the pro-
gram simple, theres no warning. Te recording simply stops as if
the user had pressed the button. Tis automatic stop-and-save also
occurs when the program is terminated or otherwise deactivated;
for example, during tombstoning.
Of course, playing back a 10-minute memo is not exactly conve-
nient, either. Te Play button toggles between play and pause mode
but theres no way to rewind or fast forward. Tose features could
be added, but you know what that requires, right?
Yes: more buttons. Or perhaps even a Slider.
CHARLES PETZOLD is a longtime contributing editor to MSDN Magazine. His
new book, Programming Windows Phone 7 (Microsof Press, 2010) is available
as a free download from bit.ly/dr0Hdz.
THANKS to the following technical expert for reviewing this article:
Mark Hopkins
Microphone data is delivered to
your program in buffers that are
simply byte arrays.
SpeakMemo stores recorded
memos in isolated storage.
APRIL 1822, 2011
LAS VEGAS, NEVADA
RIO ALL-SUITE HOTEL & CASINO
BECOME
A BETTER
DEVELOPER.
ATTEND
VISUAL
STUDIO
LIVE.
VISUAL STUDIO LIVE! IS INTENSE, REAL-WORLD TRAINING
with over 50 sessions led by industry experts who will give you the insight
and knowledge to take your code to the next level.Youll get a deeper
understanding of the programming tools you use today, with a glimpse at the
future capabilities Microsoft has planned for .NET.
BUILD YOUR SKILLS IN:
Silverlight / WPF
Programming Practices
Visual Studio 2010 / .NET 4
Windows Communication Foundation (WCF)
Cloud Computing
Data Management
Web / HTML 5
Simplifcation Tools
Mobile Development
Parallel Computing
REGISTER TODAY
SAVE $300!*
USE CODE ADFEB
SUPPORTED BY:
WWW.VSLIVE.COM/LV
PRODUCED BY:
* This special Super Early Bird rate expires
February 16, so lock in your savings now!
Untitled-7 1 1/6/11 1:21 PM
msdn magazine 96
cover it up, or discuss it only in a closed mortality and morbidity
conference, he published his own case in the prestigious New
England Journal of Medicine (bit.ly/gzWN9q). Te surgical team per-
formed a full failure analysis to fnd the root cause. (Its far more
complicated than you might think; read the article.) Tey reviewed
protocols and changed some of them: for example, the alcohol prep
that washed away the supposedly indelible surgical site markings
was discontinued. Te world is a better place for this intolerance
of unacceptable events, and for the openness in dealing with those
that manage to occur.
Our industry needs the same thing. Why was data lost? It shouldnt
have been. Was the disk full? Tats a capacity problemwe know
how to solve that. Because some dimwit yanked the plug out of the
wall? Tats a durability problemwe know how to solve that, in
several diferent ways at diferent price points. Because we forgot
to check a null pointer? Easily solvable. And so on.
If our profession is ever to take its rightful place as a pillar of
society, we need to adopt this idea from another pillar.
What do you think are the never events in sofware, and how
should we prevent them? Use the link at the end of my bio to
tell me. As always, readers will be identified only by first names,
unless they request otherwise.
DAVID S. PLATT teaches Programming .NET at Harvard University Extension
School and at companies all over the world. Hes the author of 11 programming books,
including Why Sofware Sucks (Addison-Wesley Professional, 2006) and Intro-
ducing Microsof .NET (Microsof Press, 2002). Microsof named him a Sofware
Legend in 2002. He wonders whether he should tape down two of his daughters
fngers so she learns how to count in octal. You can contact him at rollthunder.com.
Never, Never Land
In last months column, I mused about how, in sofware as in life
itself, theres usually a time for an action and also a time for its
opposite. Tis month, I want to discuss the opposite of that thought,
by which I mean events for which there is never a time.
I ofen compare our sofware industry to the medical industry.
A doctor cant completely control a patients outcome. Medical
situations vary, risks always exist, stuf happens. But certain patient-
harming events should never, ever occur. We know what causes
them, we know how to prevent them; therefore, their occurrence
always constitutes malpractice. Reading the list of these never
events (bit.ly/h9RMl8) makes you wince: operating on the wrong
patient, or on the wrong part of the correct patient; leaving surgi-
cal instruments inside the patient and so on. My all-time favorite
good news/bad news jokeTe bad news is that we amputated
the wrong leg. Te good news is that your other leg is getting better
afer allbrutally illustrates the unacceptability of these events.
(I know: Plattski, you are one sick puppy. Its been said before.)
We need to adopt this same idea for our sofware: that certain
occurrences are never, ever, acceptable. We need to define these
events, publicize them and educate developers about what they
are and how to avoid them. And we need to explain to users
that they should never have to tolerate this behavior from their
sofware and shouldnt be asked to.
Heres my frst proposed never event for sofware. We wish our
programs wouldnt crash, as doctors wish their patients wouldnt
die (and they envy our reset buttons), but neither is going to happen
anytime soon. Because we know that our programs will occasion-
ally crash, I say that losing a users work in a crash is a never event.
Remember how youd work in Word or Excel for two hours, then
up would pop the dreaded Unrecoverable Application Error box
and it was all gone? Not acceptable. Ever. No matter what.
I hear lazy geeks objecting. Tats not our problem, its a matter
of education. Users just have to save their work every 10 seconds,
then theyll never lose anything. Balderdash. Tats not the users
job, any more than its the patients job to tell the surgeon: No, you
dimwit, its my other arm. Are you sure you remember which end
of the scalpel to hold? Its the surgeons job to get the operation
right, as it is ours to get the sofware right.
Because these events should never occur, its a big story when
they do. Consider respected surgeon David Ring, who operated
on the wrong hand of one of his patients at Massachusetts General
Hospital (and performed the wrong procedure, too). Rather than
DONT GET ME STARTED DAVID PLATT
Certain occurrences are never,
ever, acceptable. We need to
dene these events, publicize
them and educate developers
about what they are and
how to avoid them.
Untitled-1 1 1/12/11 10:03 AM
Untitled-1 1 11/4/10 4:37 PM
update
The Latest Software Components and Tools for Developers
DXperience
All DevExpress ASP.NET, WinForms, WPF,
Silverlight and Productivity Tools
in one package
/issue 77/us edition
www.componentsource.com
US Headquarters
ComponentSource
650 Claremore Prof Way
Suite 100
Woodstock
GA 30188-5188
USA
Tel: +1 (770) 250 6100
Fax: +1 (770) 250 6199
European Headquarters
ComponentSource
30 Greyfriars Road
Reading
Berkshire
RG1 1PE
United Kingdom
Tel: 0118 958 1111
Fax: 0118 958 9999
Asia / Pacific Headquarters
ComponentSource
3F Kojimachi Square Bldg
3-3 Kojimachi Chiyoda-ku
Tokyo
Japan
102-0083
Tel: +81-3-3237-0281
Fax: +81-3-3237-0282
(888) 850-9911
Sales Hotline:
Learn more at componentsource.com/devexpress
www.componentsource.com 3
Why buy from ComponentSource?
ComponentSource
650 Claremore Prof Way
Suite 100
Woodstock
GA 30188-5188
USA
Tel: 770 250 6100
Fax: 770 250 6199
ComponentSource
30 Greyfriars Road
Reading
Berkshire
RG1 1PE
United Kingdom
Tel: 0118 958 1111
Fax: 0118 958 9999
ComponentSource
3F Kojimachi Square Bldg
3-3 Kojimachi Chiyoda-ku
Tokyo
Japan
102-0083
Tel: 03-3237-0281
Fax: 03-3237-0282
Argentina .......................... 0800 666 3484
Australia............................. 1 800 0 15292
Austria ................................ 0800 281 750
Belgium................................. 0800 7 5603
Brazil................................. 0800 891 6478
Bulgaria .......................... 00800 115 4445
Canada ............................... 888 850 9911
Chile ................................. 1230 020 6857
China (North) .................. 10800 481 1661
China (South) ................. 10800 813 1594
Colombia ........................ 01800 710 2043
Croatia ................................. 0800 222550
Czech Republic .................... 800 143 313
Denmark ................................ 80 88 17 20
Ecuador ............................. 1 800 010 562
Finland ................................ 0800 1 18002
France ............................... 0800 90 92 62
Germany .......................... 0800 186 07 06
Greece ........................... 00800 44121891
Hong Kong............................ 800 908 581
Hungary ............................... 06800 16674
India ............................ 000 800 44 01 455
Ireland, Rep. ...................... 1 800 535 661
Israel ................................... 180 924 2003
Italy ........................................ 800 790046
Japan .................................. 0120 343 550
Korea, Republic of ..... 00798 14 800 6332
Mexico ........................... 01 800 681 1559
Netherlands, The .............. 0800 022 8832
New Zealand ......................... 800 449181
Norway ................................... 800 1 3685
Panama ...................... 00 1 800 203 1587
Peru ....................................... 0800 53288
Poland ............................ 00800 442 1092
Portugal ................................ 800 844 125
Russia........................ 810 800 2251 1044
Singapore ........................... 800 810 2136
Slovenia ................................. 0800 80297
South Africa ....................... 0800 99 1088
Spain .................................... 900 93 8926
Sweden................................. 020 794 989
Switzerland ......................... 0800 83 5305
Taiwan .............................. 00 801 814313
Turkey.......................... 00 800 4491 3617
United Kingdom ................... 0800 581111
United States ..................... 888 850 9911
Uruguay ........................... 000 401 902 38
Venezuela........................ 0 800 100 9103
Open 24 hours a day, Monday to Friday
International customer service centers in the US, UK and Japan.
Speakers available:
English / Spanish
Opening Hours:
9:00 am - 7:00 pm EST
Speakers available:
English / Japanese / Korean /
Mandarin / Cantonese
Opening Hours:
10:00 am - 6:00 pm JST
Speakers available:
English / French / German /
Spanish / Italian
Opening Hours:
9:00 am - 5:30 pm GMT & CET
Americas
ComponentSource offers a unique global service, used by over 1,000,000 developers worldwide.
EMEA Asia-Pacific

Single Source
For all your
Software Projects,
we are your
one-stop shop.

Toll Free telephone support in 47 countries


Available in English, French, German, Italian, Spanish, Japanese, Korean, Cantonese and Mandarin.
Localized Web
Browse our multilingual sites
or use our Live Chat service.
Pay via purchase order, check,
bank transfer or credit card in
20 currencies.

Product Choice
Choose from over
10,000 hand-picked,
commercial grade
Product SKUs.
Benet from Back-2-Back
Support, our unique service
level guarantee.

Impartial Advice
Get free, independent
advice from our
product experts.
With over 15 years
experience, we know
the market.

Trusted Supplier
As O cial Distributors,
we also supply
Corporate, Reseller
and Government
institutions globally.
USA toll free: (888) 850-9911
4
www.componentsource.com
/n software Red Carpet Subscription
gives you components for every
major protocol from FTP to IMAP to
SNMP, SSL and SSH security, S/MIME
encryption, digital certicates, credit
card processing, ZIP compression,
shipping & tracking, e-business (EDI)
transactions and robust Enterprise
ready Internet connectivity, secure
messaging and le transfer for Windows
Workow Foundation. There are no
licensing restrictions, so you can code
on your work machine, your notebook
or even your home machine. Plus there
are no technology restrictions, so you
get everything: .NET, COM, C++, Java,
Pocket PC, UNIX, Linux, Mac OS X and
iPhone. You receive quarterly update
CDs with free updates, upgrades and
new releases. It includes more than
$30,000 worth of software including:
all /n software products - IP*Works!,
SSL, S/MIME, S/Shell, Zip, EDI, Amazon
Integrators, Shipping Integrators,
SharePoint Integrators, Integrators
for QuickBooks, Enterprise Adapters,
Paymentech, E-Payment, Vital/TSYS,
USPS, PaytPal, Workow Activities etc.
/n software Red Carpet Subscription
includes IP*Works! which is a
comprehensive framework for
Internet development and is the core
building block for most /n software
products. IP*Works! eliminates the
complexity of Internet development by
providing easy-to-use, programmable
components that facilitate tasks such
as sending email, transferring les,
managing networks, browsing the Web,
consuming Web services, etc.
It includes support for all major internet
protocols: ATOM, DNS, FileMailer, FTP,
HTMLMailer, HTTP, ICMPPort, IMAP,
IPDaemon, IPInfo, IPMonitor, IPPort,
LDAP, MCast, MIME, MX, NetClock,
NetCode, NetDial, NNTP, Ping, POP,
RCP, REST, Rexec, Rshell, RSS, SMPP,
SMTP, SNPP, SOAP, Syslog, Telnet,
TFTP, TraceRoute, UDPPort, WebDav,
WebForm, WebUpload, Whois, XMLp
and XMPP.
Also included in the /n software Red
Carpet Subscription is IP*Works! SSL
which is a suite of secure, SSL-enabled
drop-in replacements for the classic
IP*Works! components.
The components are fast, robust, and
reliable and consume a minimum
of resources. They are small and
lightweight with no dependencies on
external libraries. Included are native
development components for all
supported platforms. IP*Works! includes
a complete unied framework with a
common, easy to learn object model
and simplied interfaces allowing you
to be more productive. The components
are rigorously tested having undergone
thousands of hours of testing, you also
get reference documentation, hundreds
of sample applications and fully indexed
help les.
/n software Red Carpet Subscription
SharePoint Integrator Products
Interface directly with SharePoint
Server and provide access to a wide
range of SharePoint data access and
management capabilities.
IP*Works!
A comprehensive framework for
Internet development.
Windows Workow F oundation
Activities
Includes activities that make it easy
to integrate Internet capabilities
into your workow packages.
Internet C ommunications
ATOM, REST, MX, DNS, RSS, NNTP,
SMPP, POP, Rexec, Rshell, SMTP,
SOAP, Telnet, Ping, TFTP, FileMailer,
NetClock, FTP, HTTP and more.
Everything in One Subscription
There are no technology
restrictions, you get everything,
.NET, COM, C++, Java, UNIX, Linux
even Mac OS X and iPhone.
Secure C omponents
/n software Red Carpet
Subscription includes secure
versions of many of the IP*Works!
components.
/n software
/n software Red Carpet Subscription Q1 2011
Components for FTP, IMAP, SNMP, SSL, SSH, S/MIME, digital certicates, credit
card processing and e-business (EDI) transactions
Integrate SharePoint Site, List, and Document management functions
Write communications, security and e-business applications.
One developer, multiple workstations, all /n software products.
Product Top 250 Review Price
IP*Works! E DI .NET E dition V8.0 98 - $489 .02
/n software Red Carpet Subscription Q1 2011 100 - $1,424 .05
IP*Works! ActiveX C OM E dition V8.0 180 - $629 .10
IP*Works! SSL C++ E dition V8.0 204 - $949 .05
IP*Works! Z ip .NET E dition V8.0 212 $369 .08
IP*Works! C++ E dition V8.0 222 - $759 .05
IP*Works! SSL PHP E dition V8.0 228 - $809 .10
IP*Works! SSL .NET E dition V8.0 231 - $809 .10
QuickBooks I ntegrator .NET E dition V5.0 - - $539 .10
IP*Works! Z ip Java E dition V8.0 - - $449 .10
Product Top 250 Review Price
IP*Works! .NET E dition V8.0 - - $539 .10
/n s oftware N etCmdlets V2.0 - - $77 .42
/n s oftware Shar ePoint E xtensions V3.0 - - $587 .02
/n s oftware Workow A ctivities V3 - - $97 .02
Amazon I ntegrator .NET V4 - - $587 .02
E-Banking I ntegrator Java E dition V3 - - $539 .10
E-Payment I ntegrator ActiveX E dition V5 - - $379 .05
Paymentech I ntegrator .NET Edition V6.0 - - $2,449 .02
PayPal I ntegrator Java E dition V3.0 - - $391 .02
PayPal I ntegrator ActiveX / VB Edition V3.0 - - $391 .02
FROM /N SOFTWARE
USA toll free: (888) 850-9911
6
www.componentsource.com
Aspose.Total for.NET oers every
.NET component that Aspose has
available. With it you will be able to
programmatically manage some of
the most popular le formats used
in business: Word, Excel, PowerPoint,
Project, PDF and Flash. Aspose Total
.NET also supports mail merge, creating
shapes on slides, extracting text from
PDF les, creating adhoc reports with
graphs and pivot tables and more. Your
Aspose Total .NET purchase includes 1
year of maintenance and support so you
will obtain all updates and new Aspose
Total .NET components released during
the year.
Aspose.Words for .NET is a class library
that enables you to perform a wide
range of document processing tasks
directly within your .NET applications.
Aspose.Words for .NET supports DOC,
OOXML, RTF, HTML, OpenDocument,
PDF, XPS, EPUB and many other formats.
With Aspose.Words you can generate,
modify, convert, render and print
documents without using Microsoft
Word.
Aspose.Cells for .NET provides a
exible group of components that
enable .NET applications to create and
manage Excel Spreadsheets without
requiring Microsoft Excel to be installed
on the server.
Aspose.Pdf for .NET is a PDF document
creation component that enables your
.NET applications to read, write and
manipulate PDF documents without
using Adobe Acrobat.
Aspose.Slides for .NET is a PowerPoint
management component that enables
.NET applications to read, write and
manipulate PowerPoint documents
without using Microsoft PowerPoint.
Aspose.Slides for .NET supports
formats including PPT, PPS, POT and
PresentationML (OOXML, PPTX).
Aspose.BarCode for .NET is a robust
and reliable barcode generation and
recognition component.
Aspose.Tasks for .NET enables .NET
applications read and write Microsoft
Project documents without utilizing
Microsoft Project.
Aspose.Network for .NET is a suite
of components for professional
network programming, which includes
implementations of most of the major
network protocols.
Aspose.Report for .NET can be used
for a variety of tasks, ranging from
creating adhoc reports to building quick
and easy search screens and production
of a variety of great looking charts.
Aspose.Total
Aspose.Slides
Enables your application to read
and write PowerPoint documents
without utilizing Microsoft
PowerPoint.
Aspose.Cells
Lets you create and manage Excel
Spreadsheets without requiring
Microsoft Excel.
Aspose.Pdf.Kit
Easily manipulation existing PDF
documents.
Aspose.Words
Lets you read, modify and write
Word documents without utilizing
Microsoft Word.
Aspose.BarCode
Barcode generation and
recognition component, written
in managed C# for your WinForms,
ASP.NET and .NET CF applications.
Aspose.Pdf
Lets you create PDF documents
without utilizing Adobe Acrobat.
Aspose
Aspose.Total .NET Q1 2011
Supports Word, Excel, PowerPoint, Project, PDF and Flash le formats
Demos written in C# and VB.NET highlight the best practices for
implementing many common tasks
Create, manage and convert many popular document formats.
Aspose.Total .NET oers every .NET component that Aspose has
available as well as all new components released during the
annual subscription.
Product Top 250 Review Price
Aspose.Total .NET Q1 2011 18 - $1,959 .02
Aspose.Cells Java V2.4 25 - $881 .02
Aspose.Words .NET V9.3 31 - $881 .02
Aspose.Words Java V3.3 72 - $881 .02
Aspose.Slides .NET V4.2 117 - $587 .02
Aspose.BarCode Java V2.0 158 - $391 .02
Aspose.Cells .NET V5.1 202 - $881 .02
Aspose.Pdf .NET V4.6 - - $587 .02
Aspose.Tasks .NET V3.0 - - $587 .02
Aspose.BarCode .NET V3.5 - $391 .02
Product Top 250 Review Price
Aspose.BarCode f or Jas perReports V1.2 - - $391 .02
Aspose.BarCode f or Re porting S ervices V2.2 - - $391 .02
Aspose.BarCode P roduct F amily - - $636 .02
Aspose.Cells f or Reporting S ervices V1.5 - - $881 .02
Aspose.Cells f or SharePoint V1.0 - - $881 .02
Aspose.Cells P roduct F amily - - $1,469 .02
Aspose.Flash .NET V2.9 - - $391 .02
Aspose.Flash for Reporting Services (SSRS) V1.1.0 - - $391 .02
Aspose.Flash P roduct F amily - - $636 .02
Aspose.MetaFiles Java V1.6.1 - - $195 .02
FROM ASPOSE
NEW RELEASE
USA toll free: (888) 850-9911
10
www.componentsource.com
ComponentArt Data Visualization for
.NET Ultimate is a suite of Silverlight
and WPF controls for the development
of digital dashboards and data analysis
applications. It includes charting,
gauges and maps along with data
display and processing components.
Charting: A set of charting components
(XY, pie, funnel, radar, tree map, legend,
drill down manager, WCF data provider,
etc) designed to deliver interactive
visualization of business data. The
components feature brilliant rendering,
drill-downs, built-in zooming & scrolling
and annotation objects. Enterprise
charting features include the ability
to handle very large datasets and
CalcEngine integration.
Gauges: A wide selection of digital
gauge controls (radial linear, numeric,
bullet graph, cylinder, half donut,
thermometer, etc). The components
feature easy KPI (key performance
indicator) binding, customizable
pointers, scales and ranges, exible
inner layout and smooth animation. All
controls include professional skins and
themes.
Maps: Dynamic, data-driven maps
designed to provide visualization of
geographic data. The components
feature drill-downs, multiple shape
layers, tooltip & point templates and
exible projections. Includes over 100
maps covering all world continents &
regions, major countries, all US states
and custom maps.
GridView: A data grid control which
delivers a visually rich display of
tabular data. The components feature
data grouping, sorting, ltering, and
operating in spreadsheet or paged
grid modes. Enterprise grid features
include handling very large datasets,
cell formulas, calculated styles and
CalcEngine integration.
TimeNavigator: An innovative
control that allows quick, interactive
and intuitive date range selections.
It features hierarchical date and time
drilldowns: decade, year, quarter,
month, week, day, hour, minute,
second. The component also includes
customizable scal year oset, list
of business days and/or holidays,
international calendars and more.
CalcEngine: A general purpose data
processing engine, used to perform
complex operations on a given dataset.
It features ComponentArt Calc, an
interpreted expression language for
dynamic data transformations on the
client. The CalcEngine is loaded with
useful & functional libraries including:
set operations, statistical & nancial
functions.
Subscription License includes all minor
and major product updates for a period
of one year.
ComponentArt Data Visualization for .NET Ultimate
Charts
Includes a variety of 2D and 3D
shapes and the ability to customize
data point annotations and popups.
A Highly Interactive Control for
Date Range Selections
TimeNavigator was designed to
enable quick and intuitive date
range selections.
Eective Spreadsheet and Paged
Display of Data
Choose between two interfaces for
tabular data: a spreadsheet and a
traditional paged data grid.
Gauges
A wide selection of digital gauge
controls, featuring easy KPI binding,
customizable pointers, scales &
ranges and smooth animation.
Eective Visualization of
Geographic Data
Included is a large collection of
over 150 ready-to-use maps of
continents, regions and countries.
Bar & Column Charts
includes a variety of attractive
2D and 3D bar and column chart
shapes.
ComponentArt
ComponentArt Data Visualization for .NET Ultimate 2011
Enterprise-grade charting, gauges and maps along with state-of-the-art
data display and processing components
Brilliant rendering, interactive drill-downs, zooming & scrolling
Controls for digital dashboards and data analysis applications in Silverlight and WPF.
A complete feature set for building next-generation digital
dashboards and data analysis applications.
Product Top 250 Review Price
ComponentArt Web.UI for ASP.NET AJAX 2011 76 $783 .02
ComponentArt UI Framework for .NET 2011 82 $1,077 .02
ComponentArt Data Visualization for .NET Ultimate 2011 - - $5,879 .02
ComponentArt Charting for Silverlight 2011 - - $881 .02
ComponentArt C harting f or WPF 2011 - - $881 .02
ComponentArt Data Visualization for Silverlight 2011 - - $1,959 .02
ComponentArt D ata Visualization f or WPF 2011 - - $1,959 .02
ComponentArt Gauges for Silverlight 2011 - - $587 .02
ComponentArt G auges f or WPF 2011 - - $587 .02
Product Top 250 Review Price
ComponentArt GridView for Silverlight 2011 - - $587 .02
ComponentArt G ridView f or WPF 2011 - - $587 .02
ComponentArt Maps for Silverlight 2011 - - $587 .02
ComponentArt Map s f or WPF 2011 - - $587 .02
ComponentArt SOA.UI for .NET 2011 - $587 .02
ComponentArt TimeNavigator f or Silverlight 2011 - - $587 .02
ComponentArt TimeNavigator f or WPF 2011 - - $587 .02
ComponentArt Web.UI f or S ilverlight 2011 - $783 .02
ComponentArt Win.UI f or WPF 2011 - $783 .02
FROM COMPONENTART
NEW RELEASE
USA toll free: (888) 850-9911
www.componentsource.com 11
ComponentOne Studio Enterprise
includes hundreds of components
for Silverlight, WPF, .NET, ASP.NET,
ActiveX, iPhone & mobile devices. It
oers a complete solution that targets
all runtime environments and all
application layers (data, presentation,
reporting and transformation).
Silverlight toolset includes: Feature
packed Silverlight components (grid,
chart, menu, treeview, uploader, layout,
data input, gauges, maps, image rotator,
navigation, etc ). You can use expression
blend to fully style the Silverlight
controls which allows developers to
easily create rich graphical interfaces
for their Rich Internet Applications.
Built with XAML, the Silverlight controls
promote collaboration in your team
and t seamlessly into your developer
& designer workow. Furthermore, you
can take XAML from Silverlight and use
it in your WPF application. Also available
from ComponentOne is the XAP
Optimizer which helps you optimize
the size of the XAP les within your
Silverlight applications.
WPF toolset includes: Schedule
for WPF - a suite of tools delivering
scheduling, month calendar and
multi-month calendar components
for the WPF platform. Chart for
WPF - visually stunning 2D/3D bar,
area, line, pie and column charts.
Grid for WPF - a set of controls that
allow you to integrate grids into your
WPF applications. Reports for WPF -
includes a set of WPF reporting tools:
the C1Report, C1PrintDocument, and
C1DocumentViewer components as
well as the C1ReportDesigner stand-
alone application.
ASP.NET toolset includes: Styled, easy-
to-use controls built on Web standards
including AJAX, CSS, and XHTML.
Components include: eCommerce
(PayPal), le format management (PDF,
Flash, XLS, ZIP), calendars, charting (2D
and 3D), rich text editing, grids, input
and mask controls, menus and toolbars,
reporting, scheduling and spelling
features. You can also recreate the
look & feel of iPhone and iTouch user
interfaces using Button, LaunchPad,
Calendar, NavigationList & Slider
components.
WinForms toolset includes: .NET
controls featuring two award-winning
grids: FlexGrid and True DBGrid. FlexGrid
is designed for unbound applications.
It is a exible grid control for creating
user-friendly interfaces that display,
edit, format, organize, summarize, and
print tabular data. The strength of True
DBGrid is in its data binding; with an
ADO.NET managed database interface,
it oers features such as Excel-like split
views and built-in hierarchical binding
and grouping.
ComponentOne Studio Enterprise
iPhone and iTouch
Includes ASP.NET components
developed to mimic the look and
feel of the native UI of the iPhone
and iTouch.
Microsoft Outlook-style
Scheduler
Schedule one-time, all day, or
recurring appointments with
reminders, labels, etc.
ComponentOne Book for
Silverlight
Present UIElement objects as if they
were pages in a regular paper book.
Advanced Charting for your WPF
Applications
Brings you powerful rendering,
animations and data-binding
capabilities.
Create Responsive Grid
Applications with Built-in AJAX
Easily group, sort, lter, resize, and
reorder columns at run time, all
through simple drag-and-drop.
ComponentOne PDF for
WinForms
Supports AcroForms and
AcroFields.
ComponentOne
ComponentOne Studio Enterprise 2011 v1
Full suite of rich and exible .NET Windows Forms components
Rapid development of innovative & demanding Web applications
Includes innovative Silverlight controls
Components for Silverlight, WPF, .NET, ASP.NET, ActiveX & Mobile Devices.
Create rich user interfaces for Silverlight, WPF, .NET, ASP.NET,
ActiveX, Mobile and Windows Forms applications.
Product Top 250 Review Price
ComponentOne Studio Enterprise 2011 v1 8 $1,170 .00
ComponentOne Studio for WinForms 2011 v1 20 $720 .00
ComponentOne Studio for Silverlight 2011 v1 69 $720 .00
True D BGrid P ro 8.0 77 $490 .00
ComponentOne D oc-To-Help Enterprise 2011 v 1 89 - $1,056 .00
ComponentOne Studio for ActiveX 2011 v1 123 - $720 .00
ComponentOne Li veLinq 3.5 146 - $910 .00
ComponentOne D oc-To-Help For Word 2011 v 1 186 - $816 .00
ComponentOne C hart 8.0 207 $490 .00
VSFlexGrid P ro 8.0 223 $490 .00
Product Top 250 Review Price
ComponentOne Chart for Winforms 2011 v1 226 - $490 .00
ComponentOne Studio for Mobile Devices 2011 v1 243 - $720 .00
ComponentOne OLAP for WinForms 2011 v1 - - $1,620 .00
ComponentOne FlexGrid for Winforms 2011 v1 - - $490 .00
ComponentOne Studio for ASP.NET AJAX 2011 v1 - - $720 .00
ComponentOne Chart for Sharepoint 2011 - - $480 .00
ComponentOne DataGrid for SharePoint 2011 - - $480 .00
ComponentOne D emoWorks - - $1,056 .00
ComponentOne Editor for WinForms 2011 v1 - - $490 .00
ComponentOne I ntelliSpell - - $182 .00
FROM COMPONENTONE
BEST SELLER
USA toll free: (888) 850-9911
14
www.componentsource.com
DXperience includes all Developer
Express products engineered for Visual
Studio and the .NET Framework. Priority
technical support is also included
with updates and upgrades for 1 year.
With this subscription, you receive key
technologies by Developer Express
including IDE productivity tools,
business application frameworks, and
components for Windows Forms,
ASP.NET, WPF and Silverlight. In addition
to the individual tools, you receive
complete source code for the Windows
Forms & ASP.NET components. With
the Universal subscription, you also
receive eXpressApp Framework which
is an instrument for creating business
applications quickly and easily.
WPF products include: DXGrid for
WPF - fast server-side data processing
and complete support for templates
and styles, DXCharts for WPF -
clear & compact XAML syntax and
element customization via templates,
DXCarousel for WPF - stunning
navigation and data browsing,
DXNavBar for WPF - easy and intuitive
navigation.
Silverlight products include:
AgDataGrid - fast data manipulations
and rich end user experiences,
AgRichEdit - Word like text editing
features, AgMenu - static menus,
toolbars and context menus etc,
AgLayoutControl - layout management
for Silverlight.
Windows Forms products include:
XtraGrid Suite - a grid control with
four data layout options from a simple
table to banded multi-line row layout
and card views, XtraScheduler Suite
- enables you to incorporate the UI
found in O ce Calendar within your
applications, XtraPivotGrid Suite
- a data analysis, mining and visual
reporting solution, XtraGauges - linear,
circular, digital and state indicator
gauge types, XtraEditors a library of
over 20 editors that can be used both
standalone or embedded, XtraWizard
- easily generate multi-step wizard
dialogs that fully conform to Wizard 97
or Aero standards.
ASP.NET products include:
ASPxGridView and Editors Library - a
robust grid and data editors library
for ASP.NET, ASPxPivotGrid Suite - a
multi-dimensional analysis component,
ASPxNavBar Suite - Web navigation
bar with full AJAX support, ASPxMenu
Suite - an extremely lightweight,
customizable main and context menu
and more.
Also included in the Universal and
Enterprise Editions are Visual Studio
productivity add-ins: CodeRush,
Refactor! Pro and eXpress Persistent
Objects.
DXperience
AgRichEdit for Silverlight
Allows you to introduce Microsoft
Word like text editing features into
your next Silverlight application
with ease.
XtraBars Suite Ribbon Control
and Tabbed MDI interface
With the XtraBars Suite you can
easily build Ribbons from scratch.
XtraReports End-User Designer
The XtraReports Suite features a
fully functional End-User Designer.
XtraBars S uite
You can create application menus,
galleries and contextual tabs in
ribbons.
XtraReports Master-Detail Report
With the XtraReports Suite, you can
easily build banded reports and
even Master-Detail reports.
DXGrid f or WPF
Supports both tabular and card
display formats and provides
facilities for the end-user to sort
and group data.
DevExpress (Developer Express)
DXperience v2010 vol 2
User Interface functionality for WinForms, ASP.NET, WPF & Silverlight
Display digital dashboards in your Web based applications
Includes a scheduling/planning/calendar suite for ASP.NET
All Developer Express ASP.NET, WinForms, WPF & Silverlight components & tools.
All the .NET component suites, libraries and IDE tools produced
by Developer Express in one package.
Product Top 250 Review Price
DXperience v2010 v ol 2 1 $1,234 .99
DXperience WinForms v2010 v ol 2 3 $711 .99
DXperience ASP.NET v2010 vol 2 15 $711 .99
XtraGrid .NET Suite v2010 vol 2 22 $284 .99
DXperience WPF v2010 v ol 2 49 - $759 .99
Developer Express VCL Subscription 83 - $1,469 .99
XtraReports Suite v2010 vol 2 96 $332 .49
XtraPivotGrid Suite v2010 vol 2 104 - $284 .99
XtraPrinting Library v2010 vol 2 116 $142 .49
DXperience Silverlight v2010 vol 2 128 - $711 .99
Product Top 250 Review Price
XtraCharts Suite v2010 vol 2 144 $237 .49
ASPxGridView and Editors Suite v2010 vol 2 151 - $293 .99
XtraVerticalGrid v2010 v ol 2 169 - $239 .99
ExpressQuantumPack 179 $682 .49
XtraTreeList Suite v2010 vol 2 242 - $189 .99
ASPxPivotGrid v2010 v ol 2 247 $146 .99
ExpressQuantumGrid S uite V6.53 249 $341 .24
XtraBars Suite v2010 vol 2 - $208 .99
ExpressPack - - $487 .49
CodeRush for Visual Studio .NET v2010 vol 2 - - $237 .49
FROM DEVEXPRESS DEVELOPER EXPRESS
BEST SELLER
USA toll free: (888) 850-9911
www.componentsource.com 15
AdminStudio lets you customize
installations without having to edit
Windows Installer database tables,
or even write a single line of script.
Developed specically for System
Administrators, Desktop Engineers
and Corporate IT Project Teams,
AdminStudio provides a wizard driven
interface to navigate the repackaging
process. Repackaging can be done with
the standard default options or tailored
to meet specic needs via detailed
exclusion lists, the option to capture
application or system-level changes,
output preview, registry settings and
more.
For Windows 7 projects AdminStudios
Repackager can convert older packages
into MSIs that will run on Windows 7.
AdminStudio helps ensure Windows 7
application compatibility, repackages
applications with the exibility to
support many deployment formats,
hands o completed packages to
popular deployment systems for
distribution and manages a repeatable
process. AdminStudio also incorporates
MSI 5.0, which many organizations
will use as a standard for Windows 7
migration.
AdminStudio can prepare applications
for deployment on todays leading
application virtualization systems:
Microsoft App-V and VMware ThinApp.
AdminStudio also includes easier
packaging of traditionally challenging
applications, such as Adobe Creative
Suite 3 and 4. AdminStudio is able to
create a standard process for creating
virtual packages of applications that are
challenging to prepare using the native
Microsoft App-V Sequencer. Because
AdminStudio automatically looks for
all of the required information about
an installation, there arent any steps
left out in preparing the application for
virtual deployment.
The included Application Manager
provides a single, user-friendly view
into all the data and packages in
the Application Catalog. It includes
a summary dashboard showing
high-level statistics, a list of recently
modied packages and recent catalog
management activity. You can also run
searches on the Application Catalog
from anywhere to quickly locate groups
of packages, applications, merge
modules, patches, and more. Packages
in the catalog can be grouped using
the Web-based interface to mirror your
baseline systems or any user group
and business unit in your environment,
making it easier to test new packages
before deployment and manage
installed applications. You can easily
create corporate validation rules that
run against every application to ensure
your guidelines are always followed -
and no programming is needed.
AdminStudio also includeds a Process
Assistant which takes all the complexity
out of preparing applications for
deployment. It decreases the time
required for new AdminStudio users
to prepare software packages for
deployment, while also enabling
veteran systems administrators to
e ciently jumpstart a new packaging
project.
AdminStudio
Hand O Packages to Any
Deployment Solution
AdminStudio makes it easy for you
to release software packages to any
software deployment solution.
Application Manager
Provides a single, user-friendly view
into all the data in the Application
Catalog.
Eliminate Software Conicts
Automatically detect and eliminate
conicts between Windows Installer
packages and installed apps before
you deploy.
Capture Context Data During
Repackaging
AdminStudios Repackager captures
context data during the MSI
repackaging process.
Diagnose and Repair Installed
Applications
Determine if an installed
application needs repair, what
repair is needed, and why.
Job Manager
Schedule conict testing tasks
to run anytime without human
intervention.
Flexera Software
AdminStudio Enterprise V9.5
Convert native Installshield setups into 100% pure MSI packages
Includes tools to repackage software into Windows 7-ready MSIs
PackageExpert tool facilitates automated QA testing
Prepare application packages for reliable enterprise deployment.
Quickly prepare reliable MSI and virtual packages for error-free
software deployment to any Windows OS, including Windows 7.
Product Top 250 Review Price
InstallShield Professional 2011 4 - $1,979 .01
InstallShield Premier 2011 10 - $3,959 .01
InstallAnywhere Enterprise E dition 2010 29 - $4,386 .52
AdminStudio Professional V9.5 30 - $5,939 .01
AdminStudio Standard V9.5 45 - $2,474 .01
InstallShield E xpress 2011 55 $593 .01
AdminStudio Enterprise V9.5 129 - $8,909 .01
Product Top 250 Review Price
InstallAnywhere Standard E dition 2010 130 - $1,949 .03
AdminStudio wi th Virtualization P ack Standard V9.5 - - $5,444 .01
AdminStudio wi th Virtualization P ack Professional V9.5 - - $8,909 .01
AdminStudio wi th Virtualization P ack Enterprise V9.5 - - $11,879 .01
InstallShield Collaboration V11.5 - - $395 .01
InstallShield with Virtualization Pack Premier 2011 - - $6,929 .01
InstallShield with Virtualization Pack Professional 2011 - - $4,949 .01
FROM FLEXERA SOFTWARE
USA toll free: (888) 850-9911
www.componentsource.com 19
ActiveReports 6 is a .NET reporting
component for Windows and Web
applications. Its key features include
customization, fast performance and
high quality. ActiveReports 6 features
an easy-to-use Visual Studio .NET
report designer and a powerful API. It
includes multilanguage support that
works right out of the box and also
oers seamless run-time deployment,
royalty free. Its easy to create reports
in ActiveReports 6, the report designer
integrates into Visual Studio .NET. Once
the product has been installed on the
developers machine, adding a report to
your project is as easy as adding a class
or form.
ActiveReports 6 is easy to deploy -
ActiveReports 6 reports are created
within Visual Studio .NET and compiled
directly into the executable. Therefore,
assemblies can be distributed using
XCopy deployment or they can be
placed in the global assembly cache
(GAC). The object model provides the
Reporting Engine as a single, managed,
strong named assembly. There are no
additional setups on the server or the
clients machine. Since ActiveReports
6 is fully managed, there are no
dependencies on 3rd party applications.
ActiveReports 6 can export to many
formats - it includes lters for exporting
to popular formats like Adobe PDF,
Microsoft Excel, RTF, HTML, Text and
TIFF in both Windows- and Web-based
applications.
ActiveReports 6 contains a built-in
charting control which supports
common 2D and 3D chart types and
provides advanced charting features
as well as native exporting to various
image formats. Chart types include:
vertical and horizontal bar, line, scatter
plot, pie, funnel and pyramid, Gantt,
Kagi, point and gure, renko, and more.
ActiveReports 6 supports the use
of Windows Forms-based 3rd party
controls with the report designer.
Essentially any control that is able to be
rendered on a Windows Form is capable
of being rendered on an ActiveReports
6 report.
ActiveReports 6 includes a report
viewer control and an End-User
Report Designer - The report viewer
control supports report zooming and
previewing, multiple tabs for viewing
hyperlinks, split- and multi-page views,
a table of contents pane, thumbnails,
text searches, annotations, and toolbar
customization. ActiveReports 6 also
features a royalty-free End-User Report
Designer control that allows you to
host the report designer in your own
applications to provide end users with
the ability to create and modify reports.
The Zoom toolbar item allows users to
magnify the design surface of the report
for more precise placement and viewing
of report controls. The Professional
Edition of ActiveReports 6 also includes
a Flash-based Report Viewer that
you can use to provide a seamless,
interactive report viewing experience
and no-touch printing using the widely-
adopted Adobe Flash Player. Choose
from pre-dened themes (including
O ce, Windows XP, Vista and Windows
Classic) and enhance the viewer
experience by controlling the printing,
paging, table of contents, thumbnail
views and other options.
ActiveReports 6 comes with a Microsoft
Access and Crystal report conversion
wizard that makes importing Access
or Crystal reports a breeze. This is a
very handy utility for users who have
invested a lot of time creating reports
within Access or Crystal. Not only will
the import help get you up and running
with ActiveReports 6, but the banded
report architecture is very familiar for
developers that have used Microsoft
Access reports.
ActiveReports
Built-In Charting Control
A chart control is included with
ActiveReports that supports
common 2D and 3D chart types.
Viewer Annotations
Annotations can be placed on the
report to pass notes and special
instructions on to users and
developers.
Export to Any Format
ActiveReports includes lters for
exporting to popular formats like
Adobe PDF, Microsoft Excel, RTF,
HTML, Text and TIFF.
End-User Report Designer Editing
Allow end users to edit their reports
and save new reports or load
old ones.
Hyperlinks and Drilldown
You can use hyperlinks and the
viewer hyperlink event to simulate
drill-down from one report to
another.
Viewing Web R eports
The WebViewer control provided in
the Professional Edition allows you
to write less code and view reports
more quickly.
GrapeCity
ActiveReports 6
Professional Edition features a royalty-free End-User Report Designer
Includes lters for exporting to popular formats like PDF, Excel, RTF, HTML,
Text and TIFF in both Windows- and Web-based applications
The best selling report writer with no runtimes or royalties.
Generate a wide variety of reports from your .NET applications.
Product Top 250 Review Price
ActiveReports 6 7 - $685 .02
ActiveReports f or . NET V3.0 248 $569 .05
ActiveAnalysis 2 - - $979 .02
ActiveBI S uite f or . NET V1.0 - - $1,665 .02
Product Top 250 Review Price
ActiveReports 2 f or ActiveX/COM V2.0 - $489 .02
ActiveReports Reporting/BI Suite for .NET V1.0 - - $2,351 .02
Data D ynamics Reports V1.6 - - $1,077 .02
FROM GRAPECITY
BEST SELLER
USA toll free: (888) 850-9911
20
www.componentsource.com
FarPoint Spread for ASP.NET is a
spreadsheet component that oers
intuitive customer usability along with a
wealth of grid functionality. With Spread
for ASP.NET you have exceptional
client-side validation to alert your user
of invalid data immediately and simple
client-side keyboard navigation. Written
from the ground up in C#, Spread for
ASP.NET will provide your user with an
easy and reliable, feature-rich, user-
friendly online experience.
FarPoint Spread for ASP.NET oers
excellent design time support for rapid
development using the innovative
Spread Designer and supports in-cell
editing and validation. It supports
bound or unbound modes (no dataset
needed), AJAX, native Microsoft Excel
import/export, in-cell editing, multiple
edits on multiple rows without server
round trips, client-side column/row
resizing, multiple sheets, searching,
ltering, multiple cell types, validations,
cell spans, multiple headers, sorting,
complete customization at the cell level,
over 300 built-in calculation functions,
hierarchical display and much more.
The main features of FarPoint Spread for
ASP.NET include:
AJAX Support - AJAX allows the
component to refresh without
refreshing the entire page. This aects
several features including expanding
and collapsing child sheets in a
hierarchical display, column sorting,
inserting rows, searching, ltering,
paging and formulas.
Grouping - You can set up the display
to allow Outlook-style grouping of rows.
For large amounts of data, this is helpful
to display the data in the order the
user needs. The user selects columns
by which to sort and the component
then organizes and displays the data
in a hierarchy with rows organized
accordingly.
Searching - You can search for data
in any of the cells in the workbook by
specifying the sheet and the string
of data for which to search. You also
have several searching options you can
choose from.
Row Filtering - With row ltering, you
can allow the user to lter the data in
columns on a sheet and display only
the rows of data which meet criteria
from a drop-down list or change the
appearance of rows based on that
ltering.
Frozen Rows and Columns - You can
freeze columns and rows and keep
them displayed regardless of where the
user navigates in the sheet. Frozen rows
and frozen columns do not scroll when
the user uses the scroll bar or navigation
keys in the component.
Load on Demand - You can allow the
Web page to load on demand - as
the user scrolls further down the
spreadsheet, the FarPoint Spread
component on the client loads another
page of rows from the server as needed.
This is similar to what was called virtual
mode in the COM version of the
product.
Publish Excel Workbooks Online -
You can easily publish your existing
or new Excel workbooks online by
using Spreads Excel import and export
feature.
Spread for ASP.NET
Retrieving d ata
Retrieve data from bound and
unbound sources easily.
Hierarchy
Easily display and edit your
hierarchical data. You have full
customization at the child level if
you want to hide columns etc.
Skins
Use any of the 13 predened skins
or save and load your own design.
Customized skins can easily be
shared within your dev team.
Formulas
Add calculations quickly to your
Web applications by using any of
over 200 predened algorithms or
add your own custom functions.
Sorting
Automatically sort any column in
ascending or descending order by
double clicking on the header.
Import/Export
Import/export Microsoft Excel 97
and higher les and text les. You
can also export to Spread XML.
GrapeCity
Spread for ASP.NET V5.0
Outlook style grouping allows users to sort data as required
Conditional formatting enables styling based on cell contents
Supports Load on Demand paging (virtual mode)
High-performance, fully-customizable ASP.NET spreadsheet component.
Easily present, edit and update your ASP.NET data.
Product Top 250 Review Price
Spread f or Windows F orms 5 13 - $959 .04
Spread f or ASP.NET V5.0 65 - $979 .02
Spread for .NET Bundle 197 - $1,567 .02
FarPoint S pread V8.0 244 $671 .04
Input Pro for Win Forms - - $244 .02
Button O bjx V2.0 - - $195 .02
Calendar O bjx V3.0 - - $224 .42
Product Top 250 Review Price
Enterprise Database Pack - - $881 .02
Enterprise D eveloper Toolbox - - $979 .02
Input P ro V3.0 - - $146 .02
Input Pro for Silverlight - - $293 .02
List P ro V3.0 - $240 .10
Tab P ro V3.1 - - $126 .42
FROM GRAPECITY
USA toll free: (888) 850-9911
22
www.componentsource.com
IBM ILOG Elixir Standard provides
Flex user interface developers with
a collection of innovative display
components. It consists of 10 graphical
components that present data to
users so that they can understand the
information more clearly, react faster
and make better decisions.
IBM ILOG Elixir Standard provides 10
ready-to-use user interface controls:
3D charts, gauges, maps, heat maps,
calendars, OLAP and pivot charts,
organization charts, treemaps, radar
charts, and timelines. IBM ILOG
Elixir Standards controls can be
used individually or in combination,
alongside other Flex components and
they integrate with the Adobe Flash
Builder 4 IDE.
The professionally documented
software development kit (SDK) enables
developers to ne tune the look or
behaviors of the controls.
Adobe Flex and Adobe AIR form
a powerful platform for creating
graphically rich and highly interactive
applications for the Internet (and
desktop). It provides a wide variety of
basic user interface components such
as buttons, menus and charts. Many
applications require user interfaces
that are highly graphical, going beyond
what is oered natively in the Adobe
platform. IBM ILOG Elixir Standard
enhances the Flex and AIR platforms by
adding a set of advanced user interface
controls for more intuitive, interactive
displays.
Included controls:
3D Charts - IBM ILOG Elixir Standard
comes with a full range of 3D charts
that mirror the Adobe 2D charts.
Upgrading to the third dimension and
creating more appealing dashboards
and custom applications has never been
so easy.
Gauges and Dials - Gauges and dials
are fully interactive and designed
to be connected to real-time data
sources. Developers can use them as
is, customize them or easily create new
ones with the powerful and open APIs.
Vector Maps - Easily add intuitive map
displays to your developments. Reuse
one of the provided maps or create
custom ones from standard maps you
already have. You can easily color map
areas to represent your data and overlay
these areas with any Flex object, such as
charts and labels.
Heatmaps - Heatmaps help you
display how your data is spread over
geographies or a Web page for instance.
Manipulate either x/y or lat/lon and see
your data by density or by value.
Calendar - Easily create custom and
shared planning applications with the
IBM ILOG Elixir Standard calendar.
Display multiple planning with
advanced recurrence management.
Timeline - Create easy to read charts
displaying a sequence of events
over a span of time. leverage the
built-in overview that allows intuitive
navigation.
Organization Charts - Advanced
employee organization charts are
easy to create with IBM ILOG Elixir
Standard. Quickly navigate through
peers and management relationships
with stunning animations.
OLAP and Pivot Charts - Replace OLAP
grids with highly dynamic charts for
improved insight and analysis in your
custom data.
Radar Charts - IBM ILOG Elixir
Standard radar charts are compact
dashboard displays that are used to
compare dierent key performance
indicators (KPIs) between two or more
entities.
Treemaps - Treemaps provide an
interactive experience that includes
dynamic drill down, user-dened
clustering and segment coloring and
sizing.
IBM ILOG Elixir Standard
Gauges and Dials
Gauges and dials are fully
interactive and designed to be
connected to real-time data
sources.
Calendar
Easily display multiple planning
at once together with advance
recurrence management.
Treemaps
Visually detect trends and outliers
in large data sets.
Vector Maps
Map areas are colored to represent
specic data and overlaid with
any Flex object, such as charts
and labels.
OLAP and Pivot Charts
Replace OLAP grids with highly
dynamic charts for improved
insight and analysis in your custom
data.
Charts
IBM ILOG Elixir comes with a full
range of charts.
IBM ILOG
IBM ILOG Elixir Standard V3.0
Market leading data visualization component set for Adobe Flex 4 and
Adobe AIR rich Internet application (RIA) developers
Provides: 3D charts, gauges, maps, calendars, OLAP & pivot charts and more
A collection of innovative display components for Flex user interface developers.
Data-display components that help turn raw data into clear,
actionable information through a highly graphical and interactive
user experience.
Product Top 250 Review Price
IBM ILOG Elixir Standard V3.0 11 - $999 .00
FROM IBM ILOG
BEST SELLER
USA toll free: (888) 850-9911
www.componentsource.com 23
Infragistics NetAdvantage for .NET is a
presentation layer toolset for quickly
and easily building and styling polished
application UIs and delivering a great
user experience, for WPF, Silverlight,
Windows Forms, ASP.NET and Tablet
PC. You can deliver user experiences
consistent with Microsoft O ce and
Windows, produce high performance
Web applications and create hi-delity,
cross-platform charts and gauges that
instantly provide your audience with a
clear understanding of key performance
indicators. Designed with the user
experience in mind, NetAdvantage for
.NET user interface controls give you the
ability to focus on business logic while
it takes care of the presentation. Use the
modern look & feel of Windows 7 styles
and navigation or emulate the O ce
2003, 2007 and 2010 user experiences
with predened color tables and ribbon
controls.
Infragistics NetAdvantage for .NET has
what you need to add no-touch AJAX
to your Web site with a professionally
polished UI. It includes many Windows
Forms and ASP.NET components:
grids, charts, combos, desktop alerts,
buttons, calculator, dropdown, progress
bar, scroll bar, tooltips, editors, gauge,
listbar, listview, printing, scheduling,
spell checker, tabs, toolbars and trees.
Infragistics NetAdvantage for .NET also
includes a Document Export Engine for
PDF and XPS formats and provides Web
crawler optimization, AJAX support and
SharePoint integration.
Infragistics NetAdvantage for .NET
includes Silverlight Controls for Line
of Business (LOB) Applications which
enable you to include islands of
richness into your existing Web-based
applications, giving end-users an
experience that goes beyond what
can be accomplished with mere HTML.
These controls have been built from
the ground-up using the Silverlight
platform and take full advantage of
its capabilities to help you produce
compelling Web applications.
NetAdvantage for .NET includes
next generation WPF controls which
were designed from the start with
an uncompromising attitude toward
leveraging its cinematic graphics,
rich styling, animation capabilities,
and integrated UI virtualization.
Embracing templates and exposing
numerous styling points gives you
complete command over the controls
appearance. A logical, friendly object
model makes it easy to take advantage
of the WPF platforms potential, whether
you choose to do so through declarative
UI (XAML) or code.
Multiple volume releases throughout
the year continuously add valuable new
features ensuring the tools available to
you remain leading edge.
Infragistics NetAdvantage for .NET
PDF Ex port
You can export reports to PDF
documents displaying gauges to
visually summarize data.
NetAdvantage for ASP.NET
Gauges and Chart controls let you
create an executive dashboard.
DataGrid
Create a WPF grid using
xamDataGrid, xamCarouselListBox
and xamCarouselPanel.
NetAdvantage f or Windows
Forms
Create Outlook style applications
with integrated NetAdvantage for
Windows Forms controls.
WPF C harts
Display values using columns, pie
wedges, cylinders and more using
the advanced graphics rendering
capabilities in the WPF platform.
Create Applications with O ce
2010 Styling
Also includes grids with conditional
formatting, trees, 3D charts,
menus, etc.
Infragistics
Infragistics NetAdvantage for .NET 2011 Volume 1
Comprehensive User Interface control and component toolset for .NET
O ce 2010 File Support for ExcelML les allows you to export the contents
of WebDataGrid and WebHierarchicalDataGrid.
Create commercial class UIs for Winforms, ASP.NET, WPF & Silverlight applications.
Includes essential User Interface controls for Windows Forms,
WPF, Silverlight and ASP.NET, plus application styling.
Product Top 250 Review Price
Infragistics NetAdvantage for .NET 2011 Volume 1 2 $1,139 .60
Infragistics NetAdvantage for Win Client 2011 Volume 1 5 - $399 .71
Designer Widgets V2.0 19 $295 .00
Infragistics NetAdvantage Select 2011 Volume 1 23 $399 .71
NetAdvantage U ltimate 2011 Volume 1 33 - $1,800 .25
Infragistics NetAdvantage for Web Client 2011 Volume 1 34 - $399 .71
Infragistics NetAdvantage for Silverlight Data Visualization 2011 Volume 1 46 - $975 .10
Data Widgets V3.1 78 $395 .00
Infragistics TestAdvantage for Windows Forms (for HP QuickTest Professional software) 94 - $2,935 .10
Calendar Widgets V1.1 188 $295 .00
Product Top 250 Review Price
UltraSuite V3.02 211 - $495 .00
NetAdvantage for Silverlight Line of Business 2011 Volume 1 237 - $975 .10
ActiveThreed Plus V3.0 239 - $295 .00
NetAdvantage I CONS Software & C omputing P ack V1.0 - - $195 .02
CodeAssist V1.1 - $295 .00
Infragistics NetAdvantage for WPF Line of Business 2011 Volume 1 - - $945 .25
Infragistics NetAdvantage for WPF Data Visualization 2011 Volume 1 - - $975 .10
Infragistics TestAdvantage for Windows Forms (for IBM Rational Functional Tester) - - $2,935 .10
Quince P ro V1 - - $681 .10
VBAssist V5.0 - - $179 .00
FROM INFRAGISTICS
NEW RELEASE
USA toll free: (888) 850-9911
24
www.componentsource.com
Syncfusion Essential Studio Enterprise
includes all Syncfusion products on all
technologies (WPF, Windows Forms,
ASP.NET, ASP.NET MVC and Silverlight)
Syncfusion Essential Studio Enterprise
incorporates a unique debugging
support system that allows switching
between Debug and Release versions of
the library with a single click from inside
the Visual Studio.NET IDE. Dynamic and
feature-rich, Syncfusion Essential Studio
has everything developers need to
create enterprise-class applications.
Essential Grid (ASP.NET, ASP.NET
MVC, Silverlight, Windows Forms,
WPF) - Excel-like, cell-oriented,
light-weight, virtual, data-bound
grid. Includes extremely detailed
customization down to cell level.
Multilevel undo/redo, shared scrollbar
support, data/view separation, oating
cells, multiple cell and more.
Essential Tools (ASP.NET, ASP.NET
MVC, Silverlight, Windows Forms,
WPF) - A rich set of UI controls to let you
create rich interactive applications with
the latest look and feel.
Essential Chart (ASP.NET, ASP.NET
MVC, Silverlight, Windows Forms,
WPF) - A business-oriented charting
component which oers an innovative
data object model that makes it easy to
populate a chart with any kind of data
source.
Essential Diagram (ASP.NET,
Silverlight, Windows Forms, WPF) -
An extensible, high-performance .NET
diagramming component that can be
used for developing Microsoft Visio-like
interactive graphics and diagramming
applications.
Essential BI Grid (ASP.NET,
Silverlight, WPF) - Use BI Grid to
summarize, analyze, explore, and
present summaries of critical data in
your enterprise and make informed
decisions. Users can easily drill down
into all available levels of data and it can
even be congured to drill down into
relational data.
Essential BI Gauge (Silverlight, WPF) -
provides users with the ability to display
Key Performance Indicators (KPI) from
an OLAP cube. KPIs can be displayed
with goals and status visualizations to
help create executive dashboards.
Essential BI PivotGrid (WPF) - A
cell-oriented, extensible grid control
that simulates the pivot table feature
of Excel. It pivots data to organize it
in a cross-tabulated form. The major
advantage with the pivot grid is that
you can extract the desired information
from a large list within seconds. Along
with presenting the data, the pivot grid
also enables you to summarize and
group data. It nds its main application
in the nancial domain, where it is used
to organize and analyze business data.
Syncfusion Essential Studio Enterprise Edition
Support for Financial Charts
Create advanced nancial charts
like the stock-volume chart you
see above.
Outlook UI
Create ASP.NET and Windows Forms
applications that mimic the Outlook
user interface.
Static Diagrams
Use the Diagramming package
to create Visio like diagrams and
render them in your applications.
Ribbon
Silverlight Ribbon is a user interface
library that allows users to create
UIs similar to O ce 2007.
Dynamic Diagrams
You can also create diagrams
dynamically based on relationships
in the database.
Numerous C hart Types
Includes support for Enterprise
quality chart creation capabilities
with all the chart types you can
think of.
Syncfusion
Syncfusion Essential Studio Enterprise Edition 2011
Includes components for grids, docking, charting, diagramming, PDF &
O ce reporting and scheduling
Easily build WPF and ASP.NET Business Intelligence applications
Accelerate Silverlight, WinForms, WPF, ASP.NET and ASP.NET MVC development.
Syncfusion Essential Studio Enterprise is a dynamic and feature
rich suite that has everything developers need to create
Enterprise-class applications.
Product Top 250 Review Price
Syncfusion Essential Studio Enterprise Edition 2011 61 $1,955 .10
Syncfusion Essential Studio User Interface Edition 2011 101 $1,661 .10
Syncfusion E ssential Xls IO 2011 153 $877 .10
Syncfusion E ssential G rid 2011 225 - $877 .10
Syncfusion E ssential C alculate 2011 - - $877 .10
Syncfusion E ssential C hart 2011 - - $877 .10
Syncfusion E ssential D iagram 2011 - $877 .10
Syncfusion E ssential D ocIO 2011 - $877 .10
Syncfusion E ssential E dit 2011 - - $877 .10
Product Top 250 Review Price
Syncfusion E ssential Gauge 2011 - - $877 .10
Syncfusion E ssential Grid 2011 - $877 .10
Syncfusion E ssential Grouping 2011 - - $877 .10
Syncfusion E ssential HTMLUI 2011 - - $877 .10
Syncfusion E ssential PDF 2011 - $877 .10
Syncfusion Essential Studio Business Intelligence Edition 2011 - $1,661 .10
Syncfusion Essential Studio Reporting Edition 2011 - $1,661 .10
Syncfusion E ssential Tools 2011 - $877 .10
FROM SYNCFUSION
USA toll free: (888) 850-9911
www.componentsource.com 27
Codejock Xtreme Toolkit Pro
Codejock Xtreme Toolkit Pro
Codejock Software
Codejock Xtreme Toolkit Pro
provides Windows developers with
a sophisticated set of components
to give applications a professional,
modern appearance. Included are nine
components: Xtreme Command Bars,
Xtreme Docking Pane, Xtreme Property
Grid, Xtreme Report Control, Xtreme
Calendar, Xtreme Task Panel, Xtreme
ShortcutBar, Xtreme SkinFramework
and Xtreme Controls. With Codejock
Xtreme Toolkit Pro you can create
enterprise class applications that
incorporate a full set of customizable
user interface components that include
O ce style toolbars and menus.
Several popular visual styles are
included such as O ce XP, 2003, 2007,
2010 and Visual Studio .NET.
Ribbon
Create applications with the
Microsoft O ce 2007 style
Ribbon Bar.
Calendar
Provides Windows developers
with a sophisticated Outlook style
calendar.
Grid S orting
Easily create, group and sort data
in a at or hierarchical format.
Produce Microsoft style ribbon, toolbars, menus and MDI tabs
Easily theme your application with SkinFramework for .NET
Includes an Enterprise class grid component with built in toolbar
Create O ce and Visual Studio .NET style GUI
elements.
Product Top 250 Review Price
Codejock Xtreme Toolkit Pro 88 $502 .55
Codejock Xtreme Suite Pro 165 $502 .55
Codejock Xtreme Chart Pro - - $224 .42
Codejock Xtreme Calendar - - $141 .55
Codejock Xtreme Task Panel - - $141 .55
Codejock Xtreme Command Bars - - $141 .55
Codejock Xtreme Controls - - $141 .55
Codejock Xtreme Docking Pane - - $141 .55
Codejock Xtreme Property Grid - - $141 .55
Codejock Xtreme Report Control - $141 .55
FROM CODEJOCK SOFTWARE
NEW RELEASE
Actipro SyntaxEditor
Actipro SyntaxEditor V4.0
Actipro Software
Actipro SyntaxEditor was designed to
handle advanced language parsing
and processing, with phases for
performing lexical parsing, semantic
parsing (in a worker thread), and
automatic outlining. Custom language
denitions can be developed and
distributed with your applications.
SyntaxEditor includes a complete
parser generator that helps build
semantic parsers and construct ASTs
(abstract syntax trees). Major code
editing features of the control include:
code outlining, undo redo, word
wrap, split views, current line and
bracket highlights, virtual space, block
selection, macro recording/playback,
indicators, extensible rendering,
IntelliPrompt code snippets, member
lists, smart tags and more.
Editing C# code
Edit C# code using automated
IntelliPrompt for parameter
information.
Editing VB c ode
Edit VB code using automated
IntelliPrompt for member lists.
Editing an XML SyntaxEditor
language denition le
SyntaxEditor can edit an XML
SyntaxEditor language denition
le based on an XSD.
Develop and distribute custom language denitions with your applications
Supports language merging e.g. HTML calling CSS, VBScript, etc.
Perform semantic parsing operations in a separate worker thread
Powerful code editing control with VS.NET style
productivity enhancements.
Product Top 250 Review Price
Actipro S yntaxEditor V4.0 133 $342 .95
Actipro U IStudio C ontrol S uite V2.0 162 - $293 .95
Actipro Wizard V3.0 - - $88 .15
Actipro Bar Code for WPF 2011 - - $97 .02
Actipro Docking & MDI for WPF 2011 - - $195 .02
Actipro E ditors f or WPF 2011 - - $97 .02
Actipro G auge f or WPF 2011 - - $244 .02
Actipro I cons V1.0 - - $293 .02
Actipro Na vigation f or WPF 2011 - - $116 .62
Actipro P ropertyGrid f or WPF 2011 - - $146 .02
FROM ACTIPRO SOFTWARE
USA toll free: (888) 850-9911
www.componentsource.com 31
PowerSNMP for .NET
PowerSNMP for .NET V4.2
Dart Communications
PowerSNMP for .NET is a family of
.NET classes and components used
to manage network devices and
remote management information.
Full support for SNMPv1, SNMPv2,
SNMPv3 and ASN.1 standards provide
interoperability with Enterprise
devices. The Manager and Agent
components provide for message
transport and a suite of supporting
classes provide MIB (Management
Information Base) information,
encoding & decoding and encryption
& decryption. MIB les can be parsed
and imported into C# and Visual Basic
projects to provide full intellisense
support. A MIB compiler dynamically
loads MIB les at runtime to generate
new classes and objects on demand.
Agent
You can create an application with
common SNMP agent functions
such as responding to SNMP
queries.
Generate MIB Classes
Generate class code for MIBs. This
functionality is also built into the
Manager and Agent components.
Trap C atching
Create NT services and contol
them via the Windows services
control panel.
Messages can be constructed using no security, authentication only,
or authentication and privacy with SNMPv3
A Management Information Base compiler dynamically loads MIB les at runtime
Manage, monitor and control network devices
from your .NET applications.
Product Top 250 Review Price
PowerTCP SSL f or A ctiveX V2.0 36 - $959 .04
PowerSNMP f or . NET V4.2 136 - $1,371 .02
PowerTCP F TP f or . NET V3.0 155 - $287 .04
PowerTCP for .NET and ActiveX Suite 200 - $2,111 .04
PowerTCP Mai l f or A ctiveX V2.11 - - $479 .04
PowerTCP F TP f or A ctiveX V2.1 - $287 .04
PowerWEB File Upload for ASP.NET V1.3 - $146 .02
PowerSNMP f or . NET C F V4.2 - - $1,371 .02
PowerSNMP f or A ctiveX V2.8 - - $1,175 .02
PowerTCP .NET Suite Subscription - - $1,823 .04
FROM DART COMMUNICATIONS
Desaware Licensing System
Desaware Licensing System V2.0
Desaware
Desaware Licensing System is a
cryptographic based licensing system
for .NET. It is designed for component
licensing per server/machine and
is extremely easy to use. It can
be congured for both moderate
and high security scenarios. Using
unique security features in the .NET
Framework such as strong named
assemblies and XML signatures, the
Desaware Licensing System relies
on end to end 128 bit cryptographic
techniques, avoiding the use of
hidden les, registry entries and other
traditional licensing schemes.
Desaware Licensing System also
includes an activation Web service,
with a management application (with
source).
Create Installation Codes
You can create one or more
installation codes. You can copy
the codes to the clipboard or save
them to disk.
Assemblies
Dierent types of assemblies
across dierent products, can all
be licensed with a single licensing
certicate.
Application s elect
You can select and work on
any application from a list of
applications dened on the
current server.
Supports timed demo installations and server activation
No hidden les, registry entries or background services needed
License an unlimited number of applications at no extra cost
Add a cryptographic licensing system to your .NET
applications.
Product Top 250 Review Price
Desaware Li censing S ystem V2.0 - $1,465 .10
CAS/Tester V1.0 - - $391 .02
Desaware A ctiveX Gallimaufry V2.0 - - $143 .04
Desaware F ile P roperty C omponent V1.0 - - $77 .42
Desaware NT S ervice Toolkit V2.0 - $489 .02
Desaware NT Service Toolkit .NET Edition V2.0 - - $479 .04
Desaware Universal .NET - - $636 .02
Desaware Universal COM - - $636 .02
Event L og Toolkit V1.0 - - $146 .02
INIFileTool-5M V1.0 - - $77 .42
FROM DESAWARE
USA toll free: (888) 850-9911
34
www.componentsource.com
FusionCharts Bundle
FusionCharts Bundle
InfoSoft Global
FusionCharts Bundled Pack includes:
FusionCharts, PowerCharts,
PowerMaps and FusionGadgets.
The Pack provides developers with
a collection of Flash components for
creating highly visual Web applications
based on the Adobe Flash Platform.
Developers can build cross-browser
and cross-platform solutions which
blend content, application logic
and communications delivering an
eective end user experience.
FusionCharts delivers interactive and
eye catching Flash charts. FusionMaps
can plot over 450 maps, including all
continents, major countries and all US
states. FusionWidgets is a collection of
real-time gauges, self-updating charts
and nancial charts like Gantt charts,
funnel/pyramid charts, bullet graphs,
sparklines etc.
FusionCharts Bundled Pack can be
used with any Web scripting language
like .NET, ASP, JSP, PHP, ColdFusion,
Ruby on Rails etc.
FusionMaps
Create animated, interactive and
data-driven Flash Maps for your
dynamic Web applications.
FusionCharts
Interactive and animated charts
for ASP and ASP.NET applications.
FusionWidgets
Real-time Financial and Dashboard
Charts for the Web.
Generate interactive and animated ash charts & maps in minutes
Supports over 75 chart types and 450 maps
Build cross-browser and cross-platform solutions
Cross platform charting solution for ASP, ASP.NET,
PHP, JSP & AJAX applications.
Product Top 250 Review Price
FusionCharts B undle 26 - $489 .02
FusionCharts V3.2 70 - $195 .02
FusionCharts f or F lex V1.2 87 - $293 .02
FusionWidgets v3.2 230 - $195 .02
PowerCharts v3.2 234 - $195 .02
FusionCharts f or VB V1.0 - - $97 .02
FusionMaps v3.2 - - $195 .02
FROM INFOSOFT GLOBAL
NEW RELEASE
DEXTUpload .NET Pro
DEXTUpload .NET Pro V4.0
DEVPIA
DEXTUpload .NET Pro is a component
that supports le uploads and
downloads between a Web browser
and an IIS Web server. It observes
Internet standards (RFC 1867) and can
be used in Microsoft ASP.NET.
DEXTUpload .NET Pro is HTTP-based
and uploads les from a Web browser
to a Web server quickly and e ciently.
It overcomes the limitations of
ASP.NET uploading (inconsistency
for high capacity le uploads, server
overloads and safety, etc.), is written
in C# and provides you with improved
upload speeds and stability. During
upload and download you can invoke
a progress window automatically
without installing any other software.
The pop-up progress window shows
you uploading speed, le size,
uploaded le size and time remaining.
It can also be customized by using
progress objects. DEXTUpload .NET
Pro allows you to watermark uploaded
images and convert uploaded images
to thumbnails. It supports various le
conversion formats (BMP, JPG, GIF etc.)
and provides detailed information
about image les.
Single and Multiple Uploads
DEXTUpload .NET Pro allows you
to upload single and multiple les.
Upload P rogress
You can display a custom progress
bar during the upload process.
Watermarking and Image
Format
You can upload and watermark
images and change image formats
on the y.
Allows uploads of upto 2GB les
Use of optimized parsing algorithm makes uploading speed even faster
Able to upload les to a database via a BLOB (Binary Large Object)
Add the ability to upload les to your Web
applications.
Product Top 250 Review Price
DEXTUpload . NET P ro V4.0 - - $331 .24
DEXTUpload P ro V3.5 - - $293 .02
DEXTUpload P ro E xtension V1.5 - - $761 .46
DEXTUploadJ V1.0 - - $369 .46
DEXTUploadX V3.0 - - $369 .46
FROM DEVPIA
NEW RELEASE
USA toll free: (888) 850-9911
36
www.componentsource.com
InstallAware Studio
InstallAware Studio 10
InstallAware
InstallAware is a software installation
solution for Windows Installer that
enables MSIcode scripting for rapid
setup development without the high
cost and steep learning curve of other
setup solutions. With InstallAware you
can build sophisticated installations in
record time without any programming
or scripting skills. InstallAware
provides you with the latest features
and technology support, with the
advantages of true rapid-Windows
Installer development productivity.
InstallAware lets you set up 64 Bit and
32 Bit Systems with the Same Installer
by detecting and supporting ia64 and
x64 systems including Itanium, AMD64,
and EM64T. InstallAware allows you to
ship a single hybrid MSI for both your
32 bit and 64 bit customers.
InstallAware can check your target
system and detect whether the
operating system is running on a
virtual machine. A simple checkbox
lets you limit distributions to physical
machines. It also makes it easy for your
users to update their software via the
Web, by automating the notication,
download, and setup process.
One-Click Technology
Deploy technology modules and
runtimes, such as Microsoft SQL
Express and Crystal Reports.
Dialog Des igner
InstallAwares dialog editor lets
you customize the 15 pre-built
setup themes, or design your
own themes.
Import .MSI and .MSM Files
Directly import MSI and Merge
Modules created by other
packaging applications, and edit
them within InstallAware.
InstallAware setups are easily distributed through Group Policy Objects, and
other software distribution systems
Deliver setups that display the latest visual themes
A setup authoring tool for ISVs and enterprises
deploying products, patches and Web updates.
Product Top 250 Review Price
InstallAware S tudio 10 102 - $1,959 .02
InstallAware D eveloper 10 - - $1,469 .02
InstallAware E xpress 10 - - $979 .02
InstallAware S tudio A dmin 10 - - $2,939 .02
FROM INSTALLAWARE
Janus WinForms Controls Suite
Janus WinForms Controls Suite V3.5
Janus Systems
Janus WinForms Controls Suite
consists of 100% .NET managed code
components that are designed to
provide user interfaces for Microsoft
.NET applications patterned after
Microsoft Outlook.
Janus WinForms Controls Suite
contains Janus GridEX for .NET
(Outlook Grid), Janus Schedule
for .NET (Outlook Calendar View),
Janus Timeline Control for .NET
(Outlook Journal), Janus ButtonBar
Control for .NET and ExplorerBar
Controls for .NET (Outlook Shortcut
Bar), Janus CommandManager (Menus
and Toolbars), Janus PanelManager
(Outlook / VS.NET panes), Janus
TabControl (tab control) and Janus
Ribbon for .NET (O ce 2007 style
Ribbon bar). Janus GridEX for .NET
is a data-aware, fully editable grid
component that can be bound to any
table in a dataset or to any other data
source that supports IList, ITypedList
or IBindingList interfaces. Janus GridEX
for .NET does not sacrice any group,
sort or lter capabilities, when it is
bound.
O ce 2007
Janus WinForms Controls Suite
oers an O ce 2007 visual
style for all controls included in
the suite.
Janus Schedule Control for .NET
Present appointments and
related owners in dierent views,
representing Days, WorkWeeks,
Weeks and Months.
Ribbon C omponent
Janus WinForms Controls Suite
includes a Ribbon control.
Includes an Outlook style grid, calendar view, journal, Ribbon and shortcut bar
Supports snap lines, base lines, ImageList keys and more
Unbound mode in GridEX allows you to populate rows using AddItem method
Add Outlook style interfaces to your .NET
applications.
Product Top 250 Review Price
Janus WinForms C ontrols S uite V3.5 17 $757 .44
Janus G ridEX f or .NET V3.5 91 $469 .44
Janus Web ASP.NET Server Controls Suite V3.0 126 - $661 .44
Janus Schedule and Timeline Controls for .NET V3.5 181 - $431 .04
Janus G ridEX 2000b 217 $315 .84
Janus UI Controls for .NET V3.5 - $431 .04
FROM JANUS SYSTEMS
BEST SELLER
USA toll free: (888) 850-9911
38
www.componentsource.com
LEADTOOLS Document Medical Suite SDK
LEADTOOLS Medical Imaging Suite SDK V17.0
LEAD Technologies
Optimized features to meet the specic
needs of medical imaging application
development . LEADTOOLS Medical
Imaging Suite SDK features Medical
Web Viewer Framework, Medical 3D,
Medical Multimedia, high and low
level PACS SCP and SCU functions and
controls, DICOM PACS communication
security, comprehensive full DICOM
dataset support, 8-16 bit extended
grayscale image support, image
annotation, specialized extended
grayscale image display such as
window level and LUT processing, and
specialized medical image processing.
Other features include lossless JPEG
compression, JPIP, and signed and
unsigned image data processing.
Image handli ng
Optimized internal core functions
to dramatically increase the speed
of image handling and processing.
3D R endering
Construct and view a 3D volume
from a set of homogenous 2D
medical images.
Windows and Web de velopment
Includes native 32 and 64 bit PACS
and medical imaging binaries.
Develop powerful PACS and Medical imaging applications
Development tools and components for Silverlight, Win Forms, Web Forms, WPF,
C and C++ development
Medical imaging libraries for developers.
Product Top 250 Review Price
LEADTOOLS I maging P ro SD K V17.0 57 - $895 .50
LEADTOOLS Document Imaging Suite SDK V17.0 - - $4,895 .10
LEADTOOLS Mult imedia SD K V17.0 - - $583 .10
LEADTOOLS 1D B arcode Mod ule V17.0 - - $660 .25
LEADTOOLS D ocument I maging SD K V17.0 - - $2,245 .50
LEADTOOLS I CR Mod ule V17.0 - - $2,845 .25
LEADTOOLS Me dical I maging SD K V17.0 - - $4,495 .50
LEADTOOLS OC R Mod ule V17.0 - - $1,420 .25
LEADTOOLS Vector I maging P ro SD K V17.0 - - $1,795 .50
LEADTOOLS Virtual P rinter SD K Mod ule V17.0 - - $1,420 .25
FROM LEAD TECHNOLOGIES
Nevron Chart for .NET (Windows Forms and ASP.NET)
Nevron Chart for .NET Enterprise 2011
Nevron
Nevron Chart for .NET has been
designed to be extensible, e cient
and feature rich. It can display virtually
any 2D or 3D chart including: bar,
line, step line, area, pie, point, bubble,
stock, oating bar, radar, polar, high
low, mesh surface, grid surface, shape,
smooth line, oating bar, Venn and
error with many variations (like scatter
XY and XYZ line, stacked bars etc.).
The component features full Visual
Studio design time support with many
advanced features like style editors.
It also comes with support for
many advanced features including:
customizable legends, unlimited axes,
zooming and scrolling, grouping,
ltering, full set of gauge types,
advanced formula support, nancial
and statistical functions and more.
Professional Quality
Allows you to produce
professional presentation quality
with stunning visual eects.
Customization and 3D Support
Provides XYZ Scatter Graphs,
multiple and controllable axes,
scatter stack charts, zooming and
scrolling capabilities.
Nevron Financial Charting
Includes charts for specically
targeted software rms: banks,
brokerage rms, investment rms
and other nancial companies.
Includes many chart types and circular/radial/linear gauges
Includes scrollable axes, integrated legend, chart annotations, watermarks and
an extensible chart layout manager
A powerful, exible and extensible charting
component for Windows Forms and ASP.NET.
Product Top 250 Review Price
Nevron Gauge for Reporting Services 121 - $574 .28
Nevron . NET Vision Enterprise 2011 141 - $1,549 .28
Nevron Chart for .NET Enterprise 2011 145 $866 .78
Nevron Diagram Enterprise for .NET 2011 190 $866 .78
Nevron Chart for .NET Lite 2011 - - $291 .52
Nevron . NET Vision P rofessional 2011 - - $964 .28
Nevron 3D Chart V7.1 - - $671 .78
Nevron Chart for .NET Professional 2011 - $574 .28
Nevron Chart for Reporting Services - - $866 .78
Nevron Chart for SharePoint - - $1,208 .03
FROM NEVRON
NEW RELEASE
USA toll free: (888) 850-9911
www.componentsource.com 41
TX Text Control .NET
TX Text Control .NET V15.1
Text Control
TX Text Control .NET is available in
Standard, Professional and Enterprise
editions and is a royalty-free word
processing control that oers
developers a broad range of word
processing features in one reusable
component. TX Text Control .NET
includes the ability to export all
documents to print-ready Adobe PDF
documents without any third-party
software. The fully programmable
component supports nested tables,
document sections, images, text
frames, drag and drop, headers and
footers, bulleted and numbered lists
and MS Word compatible mail merge
elds for database applications. Typical
applications include mail merge, PDF
creation, document conversion or
WYSIWYG word processing.
Character and Paragraph
Formatting
Supports both paragraph and
character based styles, as well as
multiple style inheritance.
Bullets and Numbered Lists
Provides comprehensive support
for bullets and numbered lists.
Headers and Footers
End-users can use the same
header and footer throughout a
document.
Standardized (ASP.NET & WinForms) WYSIWYG interface
Supported formats include DOC, DOCX, RTF, TXT, HTML, CSS, XML and PDF
Create and save ISO conforming PDF/A documents
Read, edit and create documents in formats like
MS Word DOCX, DOC, RTF, PDF, HTML and XML.
Product Top 250 Review Price
TX Text Control .NET Enterprise V15.1 24 - $2,182 .18
TX Text Control .NET Server V15.1 37 - $2,938 .04
TX Text Control .NET Professional V15.1 58 - $1,045 .59
TX Text Control ActiveX Enterprise V15.1 142 - $2,182 .18
TX Text C ontrol B undle Professional E dition V15.1 213 - $1,714 .02
TX Text Control .NET Standard V15.1 214 $499 .59
TX Text C ontrol R apidSpell . NET V15.1 - - $293 .02
TX Text Control ActiveX Standard V15.1 - - $499 .59
TX Text Control ActiveX Professional V15.1 - $1,045 .59
TX Text Control ActiveX Server V15.1 - - $2,938 .04
FROM TEXT CONTROL
BEST SELLER
Xceed Ultimate Suite
Xceed Ultimate Suite 2011
Xceed Software
Xceed Ultimate Suite oers both User
Interface tools for application front-
ends and data handling libraries for
application back-ends.
The Suite includes functionality for
compression (Silverlight, .NET, ASP.NET,
CF, ActiveX), encryption (ActiveX), user
interface (WPF,.NET, ASP.NET, ActiveX)
data manipulation (WF), le transfer
(Silverlight, .NET, ASP.NET, CF, ActiveX)
and binary encoding (ActiveX).
Xceed Grid for .NET (included in Xceed
Ultimate Suite) comes with 120+
features: grouping, master/detail,
Windows and O ce theming, xed
rows and columns, Excel export,
gradient maps, interactive visual styles
and cell UI virtualization.
Xceed Upload for Silverlight
Supports uploading multiple
les in a single transaction, and
supports GZip and Deate, with
controllable compression.
High-quality, Fast ASP.NET
2D/3D Chart Control
Supports 14 major 2D/3D chart
types, exible axes, scaling,
legends, drill-down, etc.
Xceed DataGrid for WPF
Features include hierarchical
master-detail; 12 exible, themed
editors; an interactive Cardow 3D
view and more.
Includes all Xceeds .NET, CF, WPF, WF, Silverlight, COM and ActiveX components
1 year Vanguard subscription includes free updates, free upgrades, all new Xceed
product releases and priority support
65+ advanced UI controls and data manipulation
libraries, for COM, .NET, CF, WF, WPF and Silverlight.
Product Top 250 Review Price
Xceed F TP f or . NET V5.0 157 - $685 .95
Xceed U ltimate S uite 2011 161 $1,631 .95
Xceed G rid f or . NET V3.9 245 $489 .95
Xceed Z ip C ompression Li brary V6.5 250 - $685 .95
Xceed Z ip f or . NET V5.0 - - $685 .95
Xceed Zip for .NET with Self-Extractor V5.0 - - $783 .95
Xceed 3D Views for WPF V4.0 - - $783 .95
Xceed A bsolute P ackager V1.1 - - $47 .95
Xceed C hart f or . NET V4.3 - - $1,175 .95
Xceed C hart f or ASP.NET V4.3 - - $1,175 .95
FROM XCEED SOFTWARE
USA toll free: (888) 850-9911
www.componentsource.com 43
Btrieve Classes for .NET
Btrieve Classes for .NET is a set of .NET
database access support classes that
enable fast, easy to program access
from .NET programs to Pervasive.SQL
databases via the Btrieve API. As such
they greatly help developers looking
to write .NET programs accessing data
in Pervasive.SQL databases or those
looking to migrate existing pre-.NET
Btrieve/Pervasive applications to .NET.
Btrieve Classes for .NET performs with
greater e ciency and hence is faster
than ADO.NET or Pervasives OLE DB
provider.
This product includes two types of
class library, the rst (DDF Class) is
specically designed for the .NET
Framework and is composed of classes
that enable smart and e cient access
to column data and denition of data
type conversion code. The second type
of class (Native Class) provides Btrieve
API level access from .NET managed
code.
Btrieve Classes for .NET includes full
support for Pervasive PSQL v9 and
Visual Studio.
Btrieve Classes for .NET V4.0
AG-TECH
Fast, easy to program access
to Pervasive.SQL databases
from .NET.
Provides direct access to Pervasives
transactional interface from within
.NET
Extended class enables maximum
performance when searching
Pervasive data
Product Top 250 Review Price
Btrieve C lasses f or . NET V4.0 - - $764 .40
FROM AGTECH
NEW RELEASE
BlueOne Components
BlueOne Components are custom
UI components, developed by
ActsOne using Action Script 3.0, with
rich functions to make Adobe Flex
applications more useful. It showcases
many eective, easy-to-use, rich
components such as BlueDataGrid,
Blue MDI Window and BluePanel.
BlueDataGrid in particular has many
functions including multi header, data
merging, tree datagrid, OLAP grid,
Excel export, totaling and sub totaling
features. BlueOne Components
includes support for Flex based PDF,
Word and Flash reporting and has an
integrated Web UI as well as an
easy-to-use editing environment.
Other features include: skin and
interface generation, an extended
textbox, easy data grid cell extending,
performance implementation,
automatic cell calculation, cell
drill-down functions, column splits,
MDI (Multiple Document Interface
Window) and an extended tree &
button control.
BlueOne Components
ActsOne
Add diverse Adobe Flex UI
functionality to your Web site.
Includes grid, grouping, tree,
totaling, calculation, input, menus,
navigation features and more
Extends Flex component functions
Product Top 250 Review Price
BlueOne Components for Flex Builder 3 - - $949 .05
BlueOne Components for Flex Builder 2 - - $949 .05
GridOne V1.0 - - $627 .00
FROM ACTSONE
ImageGear for .NET
ImageGear for .NET accelerates .NET
imaging application development.
Utilizing managed code, it provides
support for .NET, ASP.NET, Windows
Presentation Foundation (WPF),
DirectX 10, and Direct3D 10.
ImageGear for .NET controls the image
capture process and strictly adheres
to image compression standards. Your
users will quickly view over 100 image
le types through a common interface
including raster les such as TIFF and
JPEG, and vector les such as PDF and
CAD. The annotation support facilitates
enterprise collaboration.
For web applications, ASP.NET oers
zero footprint deployments and WPF
enhances the end user experience.
ImageGear for .NET v17
Accusoft Pegasus
.NET WinForms, ASP.NET and
WPF imaging SDK
Image editing and processing
Comprehensive OCR capabilities
Viewing, annotation, and printing
Product Top 250 Review Price
FormSuite v2 21 - $4,899 .02
ISIS X press V3.0 53 - $979 .02
Prizm Viewer v9 - - $93 .10
ImageGear f or .NET v17 - - $2,939 .02
Barcode X press Standard . NET V6.0 - - $1,371 .02
FROM ACCUSOFT PEGASUS
InfoScope
InfoScope is an InfoPath runtime
engine that enables users who dont
have InfoPath to use InfoPath forms
through a Web browser. InfoScope
enables inputs and updates of data
within InfoPath, and makes the entire
process interoperable with a back end
system via a Web browser.
InfoScope provides a Service Oriented
Architecture (SOA) which meets
various dierent types of complicated
business requirements through .NET
technology. This enables customers
and/or partners to integrate into
your business processes via online
electronic forms.
InfoScope also provides an InfoScope
SharePoint Web Part Control. Its a
real InfoPath form not a Web page.
No roundtrip and no modication.
Just publish and you are ready to use
InfoPath. Since InfoScope is auto-
installed to clients, you wont meet
deployment issues.
InfoScope also enables Web pages to
catch events so that you can develop
Web applications using InfoPath forms.
InfoScope V2.5
.NETXPERT
Easily post InfoPath forms to a
Web server.
Interoperable with all kinds of .NET
based Enterprise solutions
Includes Windows SharePoint
Services (WSS) support
Product Top 250 Review Price
InfoScope V2.5 - - $1,960 .00
FROM .NETXPERT
USA toll free: (888) 850-9911
44
www.componentsource.com
AH XSL Formatter
XSL Formatter oers a clear GUI,
support for over 50 languages,
PDF generation, W3C compliance,
extensions and formatting capabilities,
unlimited document size and SVG
support. In addition XSL Formatter
oers vector support for EMF and
WMF, CMYK support, and wide
ranging output capabilities such as
MathML native drawing, WordML
transformation, XSL Report Designer
integration and PDF enhancement.
It oers the ability to write in vertical
mode, to run the text from right to left
as in Arabic and Hebrew and also to
create multilingual documents with
language mixtures on the same page
and even on the same line.
AH XSL Formatter XSL Standard V4.3
Antenna House
Format XML/XSL-FO
documents, data and forms
at high speed.
Supports most Unicode languages
including Latin, Cyrillic, Greek,
Japanese, Chinese, Hangul, Arabic,
Hebrew and Thai
Produces high quality PDF les
Product Top 250 Review Price
AH XSL F ormatter Standard V4.3 196 - $4,900 .00
AH C SS F ormatter Lite V5.2 - - $1,960 .00
AH C SS F ormatter Standard V5.2 - - $4,900 .00
AH F ormatter Lite V5.2 - - $2,744 .00
O ceHTMLFilter V1.1 - - $980 .00
FROM ANTENNA HOUSE
LightningChart
LightningChart Ultimate is a
high-performance measurement,
engineering and research data
visualization SDK for .NET. It is an
entirely GPU accelerated (Direct3D)
and performance optimized data
visualization control for presenting
masses of data in 2D, 3D and polar
views. It is especially designed
for professional measurement
applications, such as data acquisition,
PC-based oscilloscopes, vibration
measurement, signal analyzers,
scientic research, medical and
other real-time measurement and
signal monitoring applications. Being
optimized for high-speed sampled
signal data handling with innovative
techniques, it is able to handle
incredible data rates.
3D views allow high-quality graphics
with many series types. 3D surfaces
can be presented with height-coloring,
wire-framing, contouring and lighting
options.
LightningChart Ultimate 1.3
Arction
High-performance data
visualization SDK.
Renders vast data sets instantly
Detailed high-capacity 3D Surfaces,
with sizes over 2000x2000
Categorizable and customizable
legend boxes, with series show/hide
functions
Product Top 250 Review Price
LightningChart P ro 1.3 - $1,783 .60
LightningChart Ultimate1.3 - - $2,420 .60
LightningChart B asic 1.3 - - $382 .20
FROM ARCTION
NEW RELEASE
Aurigma Image Uploader Flash
Aurigma Image Uploader Flash is ideal
for Web 2.0 sites with more casual
users, it makes photo uploading quick
and user-friendly.
Aurigma Image Uploader Flash allows
you to upload any le, anywhere.
You can easily upload photos, upload
videos and upload documents to social
network sites, photo sharing sites and
content management systems.
Just add the Image Uploader code to
the upload page on your website, write
a few lines of server-side code to save
les to a folder or database, and thats
it. If you are building your site using
PHP or ASP.NET, you can use special
wrapper classes which reduce the
amount of coding to almost nothing.
Aurigma Image Uploader Flash 1.0
Aurigma
Streamline photo uploads to
your website with this ash
based upload solution.
Aurigma Image Uploader Flash lets
you upload to any server platform
User-friendly multiple photo
uploader
Resize photos before upload
Product Top 250 Review Price
Aurigma I mage U ploader Flash1.0 182 - $489 .02
Aurigma F ile D ownloader 2.1 - - $146 .02
Aurigma I mage U ploader Java 6.1 - - $146 .02
Aurigma I mage U ploader ActiveX 6.1 - - $146 .02
Aurigma I mage U ploader Dual 6.1 - - $244 .02
FROM AURIGMA
BCGControlBar Library Professional Edition MFC
BCGControlBar Library Professional
Edition MFC has more than 200
(Ribbon, toolbar, menu, calendar,
grid, editor, gantt and many others)
thoroughly designed, tested and fully
documented MFC extension classes
which can be easily incorporated into
your application to save you hundreds
of development and debugging hours.
It includes advanced features such as
detachable tab panes, auto hide panes,
new docking algorithms (similar to
those introduced in Microsoft Visual
Studio and Microsoft Visio), a text
editor with syntax highlighting and
IntelliSense-style support, O ce-style
calendar, professional grids and much
more.
BCGControlBar Library Professional
MFC includes Source code and a free
one year subscription.
BCGControlBar Library Professional Edition MFC V12.1
BCGSoft
Create O ce, Visual Studio
and IE style user interfaces.
Includes a customizable O ce style
Ribbon control
Includes more than 200 well
designed, tested MFC extension
classes
Product Top 250 Review Price
BCGControlBar Library Professional Edition MFC V12.1 12 - $685 .02
BCGControlBar Li brary f or . NET V4.0 - - $538 .02
BCGPEdit V9.0 - - $195 .02
BCGSuite f or MFC V1.0 - - $489 .02
FROM BCGSOFT
BEST SELLER
USA toll free: (888) 850-9911
46
www.componentsource.com
MetaDraw
MetaDraw is a special purpose
picturebox/image editing component.
It is an Object Oriented image
component for multimedia, image
editing/annotation, etc. MetaDraw
allows you to create, edit, display
and save pictures built from a set of
graphic objects. To your application, it
looks like a standard picturebox, but it
oers unique support for metales - a
graphical format well suited to the
drawing and/or moving of graphical
objects - including the ability to
tag individual graphic objects for
HyperGraphic/HotSpot applications.
You can also use MetaDraw as a
metale viewer with support for zoom,
scroll and even selective display of
individual elements.
MetaDraw ActiveX V3.1
Bennet-Tec Information Systems
Give your application support
for the creation, editing, and
displaying of Metales.
Full support for Object Oriented
editing: moving objects, sizing,
changing colors and other attributes
Save/load pictures to/from database
elds
Product Top 250 Review Price
MetaDraw ActiveX V3.1 235 $479 .04
ALLText HT /Pro OCX V4.5 - - $343 .00
MetaDraw WinForms for .Net - - $489 .02
TBack P ro V2.0 - - $147 .00
Tlist V8.0 - - $383 .04
FROM BENNETTEC INFORMATION SYSTEMS
astah* professional
astah* professional is a system
design tool which supports UML,
Entity Relationship Diagrams,
owcharts, CRUD, data ow diagrams,
requirements tables and Mind Maps.
astah* professional includes basic
features to make modeling simple
and user friendly. astah* professional
is suitable for business use, handling
large-sized models and document
creation. It includes enriched features,
such as the ability to change your
view freely using a map view, zoom by
dragging, unlimited undo/redo, the
ability to output project information
to a CSV le, automatic generation of
class diagrams with model information,
diagram creation guidance and more.
Exporting to HTML Documents
(Javadoc) is also available and enables
people who dont have astah*
professional to see models by using a
browser.
astah* professional
Change Vision
Business process UML
modeling tool.
Edit model information directly,
without opening dialog boxes
Supported diagram types include
Class, UseCase, Sequence,
Collaboration, StateChart, Activity,
Component and Deployment
Product Top 250 Review Price
astah* p rofessional V6.2 127 $274 .40
astah* U ML V6.2 - - $49 .00
astah* s hare V2.2 - - $686 .00
FROM CHANGE VISION
Chant Developer Workbench
Chant Developer Workbench is
comprised of tools and components
for developing software that speaks
and listens. As an interactive toolset, it
provides a development and testing
environment for working with the
component libraries and the speech
technology objects they manage.
It includes a multi-document,
interactive, customizable environment,
a powerful editor with color-coded
formatting, command line testing and
event tracing.
With the component libraries, you
can manage grammars, lexicons,
proles, recognizers, synthesizers, and
text-to-speech markup directly within
application software you develop and
deploy.
Chant Developer Workbench
Chant
Comprehensive development
and testing environment for
working with speech.
ActiveX, C DLL, COM, Java, .NET, VCL,
Web, Win32, Win64 & WinCE libraries
Supports Dragon, ViaVoice, SAPI, and
VoCon recognizers
Supports Acapela, Cepstral,
RealSpeak Solo, & SAPI synthesizers
Product Top 250 Review Price
Chant D eveloper Workbench - - $881 .02
Chant G rammarKit V3.0 - - $195 .02
Chant L exiconKit V2.0 - - $195 .02
Chant P roleKit V3.0 - - $195 .02
Chant S peechKit V6.0 - - $195 .02
FROM CHANT
FaxMan
FaxMan is a programmable fax
engine for providing fax sending and
receiving capability with total control
over the faxing process and the user
interface. The developer kit includes
ActiveX OCX, DLL and managed .NET
component interfaces to support
virtually any Windows application,
and automatically works with almost
all Class 1, Class 2, and Class 2.0 fax
modems. FaxMan includes sample
source code in Visual Basic and Visual
C++.
The FaxMan SDK allows developers
to integrate Fax support for industry
standard fax modems in hours instead
of the months it would take to write
support from scratch.
FaxMan V4.6
Data Techniques
Seamlessly embed fax
support into your Windows
applications.
Create faxes from any application
using the FaxMan printer driver
Sophisticated logging keeps track of
every fax you schedule
Supports almost all Class 1, Class 2,
and Class 2.0 fax modems
Product Top 250 Review Price
FaxMan V4.6 - - $763 .20
FaxMan J r. V2.20 - $475 .20
FaxMan PDF Import Addon - - $583 .10
ImageIt V1.1 - - $78 .35
ImageMan ActiveX V8.72 - $485 .10
FROM DATA TECHNIQUES
USA toll free: (888) 850-9911
www.componentsource.com 47
Stylus Studio XML
Stylus Studio XML Enterprise Suite
is an advanced XML integrated
development environment (XML
IDE) consisting of XML tools and
high-performance Java and .NET
components for deploying data
integration applications.
Stylus Studio XML Enterprise Suite
includes features for working with XML,
XQuery, XML Pipeline, XSLT, XSL:FO,
EDI, XML Schema/DTD, XPath, XML &
databases, XHTML, XML mapping, XML
publishing and Web services.
Stylus Studio XML also features
Electronic Data Interchange (EDI)
integration tools for converting
(EDIFACT to XML, X12 to XML),
mapping and deploying advanced
XML data integration applications
which involve read/write access to
legacy EDIFACT and X12 data sources.
It also lets you create XML schema les
that correspond to the converted EDI
documents.
Stylus Studio XML Professional Suite 2011
DataDirect Technologies
Comprehensive XML
data transformation and
aggregation toolset.
Includes synchronized visual XML
editing views, Sense:X, integrated
XML validator, XML dierencing,
and more
Supports visual XQuery editing,
mapping and debugging
Product Top 250 Review Price
Stylus S tudio XML Professional S uite 2011 106 - $441 .00
Stylus S tudio XML Enterprise S uite 2011 163 - $681 .10
Stylus S tudio XML Academic E nterprise 2011 - - $392.00
FROM DATADIRECT TECHNOLOGIES
Solutions Schedule for .NET
Solutions Schedule for .NET allows
developers to create scheduling
solutions such as those found in
the healthcare or services sector.
Solutions Schedule for .NET includes
intuitive mouse driven scheduling
and planning with Gantt-style project
management features. Other features
include independent cell formatting,
timebar overlap, split and linking
styles. You can easily add a visual
reference point for the current date
and time in a schedule by using the
Current Time Line feature. Time lines
extend vertically through the schedule
area and are drawn along the major
time segments. Developers can also
add zoom-in/out capabilities by
programmatically changing the value
of the TimeDistance property.
Solutions Schedule for .NET V3.1
DBI Technologies
Build team management and
resource planning solutions.
Share schedule, appointment,
contact, location and task
information
Supports timebar linking, cell-level
formatting, multi-select timebar
and more
Product Top 250 Review Price
Solutions S chedule f or . NET V3.1 51 - $969 .22
Studio C ontrols f or . NET V1.1 - - $383 .04
Studio C ontrols f or C OM V1.1 - - $719 .04
DBI S ta-Scheduler 3.2 - - $773 .22
Extractor V7.2 - - $7,350 .00
FROM DBI TECHNOLOGIES
DataMatrix Font Kit
DataMatrix Font Kit provides a versatile
way to create DataMatrix barcodes
from within any application written in a
programming language that supports
accessing a DLL, OCX, .NET Class, Java
Class or UFL (User Function Library).
DataMatrix Font Kit translates data
into a form which may be displayed
or printed in the barcode fonts, which
are provided as TrueType, OpenType
and PostScript fonts in three dierent
weights and ve height/width ratios.
The component can return the string,
copy it to the clipboard, or write it to a
named le.
DataMatrix Font Kit includes samples
for MS O ce, VB, VB.NET, C#, Crystal
Reports and Delphi. (Crystal Reports
barcodes are limited to approximately
100 characters).
DataMatrix Font Kit V5.10
dLSoft
Create DataMatrix barcodes
from within your applications.
Includes TrueType, OpenType and
PostScript fonts
Easily translate data into the text
required to produce the barcode in
the supplied font
Product Top 250 Review Price
DataMatrix F ont K it V5.10 246 - $253 .29
QR C ode F ont K it V5.10 - - $253 .29
dBarcode.NET S tandard V4.0 - - $202 .75
dFont Barcode Fonts for Windows - Code 128/EAN 128 V5.0 - - $205 .50
Really S imple B arcodes V3.20 - - $125 .85
FROM DLSOFT
FastReport.Net
FastReport.Net is a full-featured
reporting solution for Windows
Forms and ASP.NET that can be used
in Visual Studio 2005/2008/2010.
With FastReport.Net, you can create
application-independent reports
or FastReport.Net can be used as a
standalone reporting tool. You can
connect to any database, use any
table or create and use a query to
form your reports. FastReport.Net
lets you add dialogue form(s) to your
report and using built-in scripting, you
can manage interaction between a
forms dialogue controls and perform
complex data handling. You can view
the resulting reports, print them and
export to many common document
formats.
FastReport.Net 1.5
Fast Reports
Create application
independent reports.
Wide range of report objects
available: text, picture, lines, shapes,
barcodes, table, checkbox, chart, etc
You get a full-featured reporting
solution with a runtime royalty-free
report engine and designer
Product Top 250 Review Price
FastReport.Net 1.5 201 - $293 .02
FastReport P rofessional V4.10 - - $244 .02
FastCube 1.8 - - $175 .42
FastQueryBuilder 1.03 - - $67 .62
FastReport Basic V4.10 - - $97 .02
FROM FAST REPORTS
NEW RELEASE
USA toll free: (888) 850-9911
48
www.componentsource.com
Prof-UIS
Prof-UIS is an easy-to-use MFC
extension library that enables you
to deliver Windows applications
with a professional and user-friendly
interface. More than 200 thoroughly
tested and documented C++ Classes,
templates and interfaces will help you
take the time and complexity out of
incorporating rich and up-to-date GUI
facilities in your projects including:
O ce and Visual Studio look-and-feel,
ribbons, tabbed docking windows,
tab containers with detachable tabs,
customizable data grid and property
grid controls, customizable menus,
toolbars and keyboard accelerators,
multi prole GUI persistence and more.
Prof-UIS is an extensible, object-
oriented framework that enables you
to easily customize and extend its
functionality.
Prof-UIS V2.90
FOSS Software
Create professional, modern
user interfaces for your
Windows applications.
Microsoft O ce and Visual Studio
look-and-feel
Includes tabbed docking windows,
tab containers, data grid and
property grid controls
Product Top 250 Review Price
Prof-UIS V2.90 216 - $338 .10
Elegant R ibbon V3.7 - - $142 .10
Elegant G rid V1.3 - - $93 .10
Prof-UIS F rame Features V1.2 - - $191 .10
FROM FOSS SOFTWARE
GdPicture.NET
GdPicture.NET is a suite of document
imaging toolkits delivered as .NET
components enabling developers to
compose, display, capture, edit and
print documents in .NET applications.
With GdPicture.NET your programs will
be able to display documents, acquire
images from TWAIN scanners, perform
optical character recognition (OCR)
and many other features covering
all mainstream areas of document
imaging.
GdPicture.NET technology supports
more than 45 vector and bitmap
image formats from 1-bit to 128-bit
including High Dynamic Range images,
JPEG2000, JBIG, PSD, JPEG, TIFF, PNG
and more.
GdPicture.NET V7.2
GdPicture
Add advanced royalty free
image processing to your
applications.
Display Raster Images, Metales
& PDFs within a full-featured
document viewer
Full featured & royalty free document
imaging toolkit delivered as .NET
components
Product Top 250 Review Price
GdPicture.NET V7.2.0 60 - $2,351 .02
GdPicture P ro I maging SD K V5.13 90 - $734 .02
GdPicture Tesseract P lugin - - $489 .02
GdTwain P ro SDK V2.8 - - $538 .02
GdViewer P ro A ctiveX V4.12 - - $489 .02
FROM GDPICTURE
NEW RELEASE
InaCalc.Net
InaCalc.Net supports conventional
math operators and functions and
is suitable for heavy-duty number
crunching. It also supports other data
types, such as string, date-time and
logical and comes with operators and
functions for these data types. It allows
dening variables and sets of related
formulas that implement spreadsheet-
like recalculations. The InaCalc.Net
component integrates expression
parsing, evaluating and dependent
formula recalculation. It is useful in two
general areas; when a formula has to
be dened, and, evaluated at runtime.
The InaCalc.Net component also
supports custom functions and virtual
variables.
InaCalc.Net V3.02
Inabyte
Enable advanced calculations
in your accounting or
spreadsheet application.
Integrates expression parsing,
evaluating, and dependent formula
recalculation
Includes custom function support
and multiple formula recalculation
Product Top 250 Review Price
InaCalc.Net V3.02 - - $391 .02
InaAuthenticate V2.1 - - $273 .42
InaAuthenticate.Net V3.2 - - $322 .67
InaCalc V2.5 - - $273 .42
InaCardCheck V3.0 - - $230 .30
FROM INABYTE
Setup Factory
Setup Factory oers developers
a solution for creating exible
installation systems without needing to
learn a proprietary scripting language.
It further sets itself apart by providing
the customization and advanced
control features that developers
require, all from within the Setup
Factory Visual Design Environment. You
can even deploy your applications on
Web servers. Setup Factory contains
a scripting engine that oers all the
usual programming logic such as
loops, functions and arrays and more.
It includes an action wizard that makes
it easy, even for someone with zero
programming knowledge to simply
click to add actions. Also included is
a script editor that makes it easy for
advanced users to edit code directly.
Setup Factory V8.2
Indigo Rose
Create professional
installations using a clear
visual design environment.
Wizard based creation of installation
packages (no coding needed)
Code editor for advanced developers
to ne tune installations
Extensive customization through
actions library, themes and skins
Product Top 250 Review Price
Setup F actory V8.2 166 $387 .10
AutoPlay Me dia S tudio V8.0 177 $289 .10
TrueUpdate V3.5 - - $387 .10
MSI F actory V2.1 - - $387 .10
Visual P atch V3.5 - - $387 .10
FROM INDIGO ROSE
USA toll free: (888) 850-9911
50
www.componentsource.com
RapidSpell Desktop .NET
RapidSpell Desktop .NET allows you
to add as-you-type spell checking to
any textual application (email, word
processor etc.) with a couple of lines
of code. It can also be used in non GUI
contexts using its spell checking API.
RapidSpell Desktop .NET provides 3
spelling components; RapidSpellDialog
(dialog based checker control),
RapidSpellAsYouType (as you type
check control) and RapidSpellChecker
(core spell checker class).
RapidSpell Desktop .NET includes
140,000 word U.S. & U.K. dictionaries
(and user dictionary), multi-threaded
GUI and a suggestion engine.
Additional dictionaries are available for
other languages.
RapidSpell Desktop .NET V4.7
Keyoti
Integrate spell checking
functionality into your .NET
and WPF applications.
Interactive dialog checking
Includes support for 3rd party
components
WPF support includes dialog based
checking of WPFs TextBox and
RichTextBox controls
Product Top 250 Review Price
RapidSpell D esktop . NET V4.7 - $465 .50
Keyoti Search Lite ASP.NET 2010.1 - - $425 .32
Keyoti Search Pro for ASP.NET 2010.1 - - $686 .00
RapidSpell Ja va Desktop V2.2.1 - - $224 .42
RapidSpell Ja va Web V3.1 - - $195 .02
FROM KEYOTI
AddFlow Suite
AddFlow Suite is a suite of components
that includes AddFlow and
LayoutFlow, a collection of 4 layout
components: HFlow (hierarchical),
SFlow (symmetric), TFlow (tree) and
OFlow (orthogonal). It lets you create
interactive owcharts and workow
diagrams with graph drawing
algorithms. Drawings can be made
interactively or programmatically and
features include distinct shapes, styles,
pictures, colors, fonts, user data, and
so on for each object of the diagram.
Metale support, XML serialization,
printing, zooming, custom shapes,
link autorouting, scrolling, clipboard
management, grid support, multi-
selection and customization are also
supported.
AddFlow Suite V5.4
Lassalle Technologies
Flowchart/diagram creation
and graph drawing
algorithms.
Link autorouting, gradient colors
OwnerDraw events, custom shapes
Links can be composed of many
segments
Product Top 250 Review Price
AddFlow S uite V5.4 109 - $979 .02
AddFlow ActiveX V5.4 150 $489 .02
AddFlow f or . NET V2.3 194 - $489 .02
AddFlow S uite f or .NET V2.2 - - $685 .02
AddFlow f or S ilverlight Professional V1.3 - - $685 .02
FROM LASSALLE TECHNOLOGIES
Neodynamic Barcode Professional for RS
Barcode Professional for Reporting
Services is a .NET component which
allows you to add barcode images to
Reporting Services reports. Barcode
Professional for SSRS can be used with
both Reporting Services 2000 and
2005 and can generate most popular
Linear 1D and 2D barcode symbologies
including USPS, Royal Mail, Australia
Post, Codabar, Code 11, Code 16k,
Code 39, Code 93, Code 128 (A, B, C),
Data Matrix ECC200, EAN 8, EAN 13,
JAN, Industrial 2 of 5, Interleaved 2 of 5,
ISBN, PDF 417, Postnet, UCC EAN 128,
UPC A, UPC E and many more.
Barcode images can be generated in
formats such as GIF, JPG/JPEG, BMP,
and PNG. You can rotate the barcode
image in 90, 180 and 270 degrees.
Neodynamic Barcode Professional for RS V7.0
Neodynamic
Add barcode images to your
Reporting Services reports.
Barcode image generation and
printing support for 53 Linear/1D & 9
2D Postal barcode symbologies
Automatically computes checksum
or check digits for all symbologies
Product Top 250 Review Price
Neodynamic Barcode Professional for Reporting Services Ultimate V7.0 135 - $705 .40
Neodynamic Barcode Professional for Windows Forms Standard V7.0 218 - $293 .90
ThermalLabel SDK for .NET 3.0 221 - $340 .92
Neodynamic Barcode Professional for ASP.NET Standard V7.0 - - $293 .90
ImageDraw SD K f or . NET V3.0 - - $274 .30
FROM NEODYNAMIC
NEW RELEASE
VARCHART JGantt
VARCHART JGantt is a component
written in Java, that easily lets you
integrate Gantt charts into your
application. Activities in VARCHART
JGantt can be displayed either by a
variety of pre-dened bar shapes, or
can be composed from scratch. Any
shape and pattern is available, even
dynamic bars that actively grow or
diminish to indicate the degree of
completion of an activity. Bars can
also be connected by links of dierent
types. Vertical and horizontal grids
can be placed in the Gantt graph and
the time scale can be customized by
position, scaling, colors and font.
Settings to dene the appearance and
behavior of the Gantt chart can be
dened at design time.
VARCHART JGantt V2.4
NETRONIC Software
Add interactive Gantt
diagrams to your applications.
User interactions such as create,
delete and drag & drop activities are
handled by the component
Includes zooming and scaling of
diagrams
Product Top 250 Review Price
VARCHART JG antt V2.4.4 - - $2,909 .62
VARCHART X Gantt .NET V4.4 - - $2,674 .42
VARCHART X Gantt A ctiveX V4.4 - - $2,674 .42
VARCHART XN et .NET V4.3 - - $2,841 .02
VARCHART X Tree . NET V4.3 - - $2,135 .42
FROM NETRONIC SOFTWARE
USA toll free: (888) 850-9911
www.componentsource.com 51
ImageKit.NET
ImageKit.NET lets you add image
processing to your .NET applications
quickly and easily. You can retrieve
images from TWAIN scanners and
digital cameras; load & save image les
in a variety of formats; apply image
lters and transformations to your
images; display images in the display,
pan window or thumbnail controls.
ImageKit.NET supports a variety of
raster and vector le formats and
compressions. Native .NET support
includes: BMP, JPEG, GIF, TIFF, PNG,
WMF and EMF. ImageKit.NET
includes many image eects and
transformations including: creating or
copying images, combining images,
layering images, copy and paste
images plus numerous eect lters
including blur, mosaic, outline, emboss,
oilpaint, canvas, glasstile, lens, ripple,
whirlpinch, waves and motionblur.
ImageKit.NET contains components for
both Windows Forms and Web Forms
applications.
ImageKit.NET V2.0
Newtone
100% native .NET image
processing component.
Load and save images to a variety of
image formats
Apply various imaging eects and
transformations and display those
images in various controls
Product Top 250 Review Price
ImageKit.NET V2.0 - - $704 .72
ImageKit7 - $391 .02
ResizeKit V2.0 - - $87 .32
FROM NEWTONE
MonoTouch
MonoTouch from Novell is a software
development kit that contains a suite
of compilers, libraries and tools for
integrating with Apples iPhone SDK.
MonoTouch includes Microsoft
.NET base class libraries along
with managed libraries for taking
advantage of native iPhone APIs. Also
included is a cross-compiler that can
be used for turning .NET executable
les and libraries directly into native
applications for distribution on the
Apple Apps Store or for deployment
to enterprise iPhone users. In addition,
Xcode integration enables application
developers to test on the device or in
Apples iPhone Simulator.
MonoTouch is an SDK that can be
used with your favorite editor, be
it a fully integrated development
environment or a simple text editor.
The MonoDevelop integration helps
developers get started by providing
iPhone application templates that will
get you from zero to your device in
no time.
MonoTouch 3.0
Novell
Create C# and .NET
applications for iPhone, iPod
Touch and iPad.
Distribute your applicaions on the
Apple App Store
Turn .NET executables and libraries
into native applications
Product Top 250 Review Price
MonoTouch 3.0 48 - $391 .02
Mono Tools f or Visual S tudio 2.0 110 - $97 .02
FROM NOVELL
BEST SELLER
PDFView4NET
PDFView4NET is a .NET toolkit for
displaying and printing PDF les in
.NET applications. It includes a PDF
viewer control for Windows Forms
and a .NET library for rendering and
printing PDF les from any .NET
application.
The PDF viewer control for Windows
Forms includes support for annotating
PDF les, bookmarks navigation,
adding and removing le attachments
and other features. The toolkit includes
its own PDF rendering engine and it
does not rely on any other software for
rendering and printing PDF les.
PDFView4NET toolkit has been
developed entirely in C#, being 100%
managed code.
PDFView4NET V3.0
O2 Solutions
Add PDF viewing to your .NET
applications.
Supports the displaying and printing
of PDF les
Includes a separate library for
converting PDF les to images and
for printing PDF les to any Windows
printer without any UI
Product Top 250 Review Price
PDFView4NET V3.0 99 $685 .02
PDF4NET V4.1.3 208 $489 .02
Barcode4NET .NET V2.0 - - $489 .02
Barcode4NET Windows F orms & Mob ile D evices V2.0 - - $293 .02
Barcode4NET ASP.NET & Re porting S ervices V2.0 - - $293 .02
FROM O2 SOLUTIONS
PDFlib
PDFlib is a component that allows you
to programmatically create PDF les
from within your own server-side or
client-side software. PDFlib doesnt
make use of third-party software for
generating PDFs, nor does it require
any other tools. PDFlib is available
for all major operating systems and
development environments. It oers a
variety of functions, including a table
formatter, PDF/A output for longtime
archiving, AES encryption, integrated
pCOS analyzing tools, a repair and
optimization mode for inputing PDFs.
PDFlib can generate PDF data directly
in memory (instead of on le), resulting
in better performance and avoiding
the need for temporary les which
speeds up PDF generation.
PDFlib 8.0
PDFlib
Create PDF les from within
server-side or client-side
software.
Includes functions for creating text,
graphics, images and links
Dynamically generate PDF les from
Web or database server data
New table formatter
Product Top 250 Review Price
PDFlib 8.0 - - $1,070 .34
PDFlib p COS V2.0 - - $262 .54
PDFlib Personalization Server (PPS) 8.0 - - $3,217 .75
PDFlib P LOP DS V4.0 - - $219 .59
PDFlib TET V4.0 - - $407 .41
FROM PDFLIB
USA toll free: (888) 850-9911
52
www.componentsource.com
GTP.NET
GTP.NETs overall goal and purpose
is to let you visualize and manipulate
time based information. GTP.NET
includes a collection of user interface
components which handle time
blocks. The time blocks are displayed
in a Gantt chart or a schema view. The
times are connected to an owner, for
example a person or an activity in a
project. You can also use it to display
dependencies and collisions between
times, which gives the end user a
graphical way to view and modify the
project.
GTP.NET includes the ability to select
and re-assign links and also provides
databinding for links between time
items. The components can be
delivered via WinForms, AJAX,
ASP.NET, and even in reduced trust
environments like ClickOnce and XBAP.
GTP.NET V3.3
plexityHide.com
Add interactive Gantt charts
and scheduling to your
applications.
Supports AJAX with client-movable
and resizable time items
Features asynchronous collision
detection and handling of time items
Security awareness enables
deployment on XBAP or ClickOnce
Product Top 250 Review Price
GTP.NET V3.3 74 $955 .20
Gantt Time P ackage VCL E dition V3.x 191 - $469 .44
Gantt Time P ackage A ctiveX E dition V3.x - $469 .44
GTP.NET f or S ilverlight + WPF V1.1 - - $1,225 .00
FROM PLEXITYHIDE.COM
CodeSite
CodeSite is an add-in for Delphi and
C++Builder that enables you to send
detailed information (including string
lists, objects, even bitmaps) from
within your application code to a
specialized receiver. Unlike message
boxes and inspecting variables on
breakpoints, CodeSite messages
are not transient. The resulting log
of messages sent to a destination
provides valuable information for
locating problem areas in your code.
Sending CodeSite messages does not
interrupt the ow of your application
as happens when message boxes
and breakpoints are used. As a result,
CodeSite is much more eective in
situations where user interactions (e.g.
focus changes) and painting issues
need to be tracked.
CodeSite V4.5
Raize Software
Locate and eliminate
problems in your Delphi and
C++Builder code.
Captures detailed information
CodeSite messages do not interrupt
the ow of your application
Live logging and le logging can be
performed either locally or remotely
Product Top 250 Review Price
CodeSite V4.5 - - $391 .02
DropMaster V2.1 - - $97 .02
Inspex V2.3 - - $97 .02
Raize Components V5.2 - $391 .02
ScratchPad V2.0 - - $28 .42
FROM RAIZE SOFTWARE
Resco MobileForms Toolkit
Resco MobileForms Toolkit is a suite
of components designed specically
for mobile devices. It includes
advanced designers, support of
quick data loading, standardized
mobile user interface, Enterprise
samples and many other features. It
contains AdvancedList, AdvancedTree,
CompactChart, DetailView, SmartGrid,
Zip and Outlook Controls.
All Resco MobileForms Toolkit
components have been specically
designed so they t the small displays
of mobile devices perfectly.
Special optimizations such as Resco
DelayLoad technology ensures
performance is optimized even on
devices with limited memory and
processor capabilities.
Resco MobileForms Toolkit 2011 Volume 1
Resco
Suite of .NET CF controls for
Pocket PC, Smartphone &
Windows CE.NET.
Includes grid, calendar, listview, input
form, zip compression, navigation
and touchscreen signature controls
Features a chart control with ve
dierent chart types
Product Top 250 Review Price
Resco Mob ileForms Toolkit 2011 Volume 1 43 - $783 .95
Resco Mob ileApp S tudio 2 189 - $1,175 .95
Resco A ssetInventory E SP - - $3,429 .95
Resco MobileBusiness ESP - - $3,429 .95
Resco Mob ileSurvey E SP - - $3,429 .95
FROM RESCO
NEW RELEASE
CommStudio
CommStudio makes it easy to let
your application communicate using
the serial port and modems. Sax
CommStudio provides a complete
communications solution for both
COM and .NET. The tools integrate
remote systems and devices with
Visual Studio .NET and Visual Basic 6.
CommStudios robust communications
components based on more than
ten years of market leadership are
only the beginning, the real gain in
developer productivity comes from Sax
CommStudios advanced debugging
and analyzing tools. Sax CommStudio
supports a large variety of serial port
connections including: standard
built-in serial ports, virtual serial
ports on other systems via network
software, Bluetooth and infrared serial
ports, high performance serial ports
using specialized hardware such as
Digiboards etc. The number of serial
ports supported on a single system is
only limited by hardware.
CommStudio
Sax.net
Serial Communications made
easy.
Supports common le transfer
protocols, serial ports and modems
Includes ActiveX components
compatible with the MSComm
control
Product Top 250 Review Price
CommStudio A ctiveX - - $949 .05
CommStudio . NET - - $783 .02
Crescent Q uickPak V4.5 - - $759 .05
FROM SAX.NET
USA toll free: (888) 850-9911
54
www.componentsource.com
FTP Wizard
Seekford Solutions FTP Wizard allows
you to easily upload and download
les from an FTP server. Using the File
Transfer Protocol, you can get directory
listings, make directories, delete les
and directories, rename les, upload
and download les. The product makes
implementation simple. It provides an
interface to the File Transfer Protocol,
allowing developers to implement
this functionality without learning
the complexities of FTP and TCP/IP.
Multiple instances of FTP Wizard can
be created to talk to multiple FTP sites
at a time.
FTP Wizard includes asynchronous
operation and allows you to create
applications that require no user
interaction.
FTP Wizard V3.0
Seekford Solutions
Add FTP support to your
Windows applications.
Add functionality without learning
the complexities of FTP or TCP/IP
Includes samples for Visual Basic,
Visual FoxPro, Visual C++, ASP and
VBScript
Product Top 250 Review Price
FTP Wizard V3.0 - $191 .04
SMTP Wizard SSL V3.0 - - $191 .04
.NET D NS MX Wizard V3.0 - - $195 .02
.NET E mailValidation Wizard V3.0 - - $195 .02
.NET E ncoder Wizard V3.0 - - $195 .02
FROM SEEKFORD SOLUTIONS
SWIFT Framework .NET
SWIFT Framework .NET is a system
for capturing, validating and
processing SWIFT messages within an
organizations information systems
infrastructure. SWIFT Framework
.NET allows seamless integration
into existing IT systems and can be
a base to build up a clean and fully
compatible SWIFT messaging system.
SWIFT Framework .NET includes a
generic system for the loading, storing
and validation of SWIFT messages. It
is also Microsoft BizTalk XML schema
and object model compatible (without
the need to install BizTalk itself ). SWIFT
Framework .NET enables validation
based on message (or message block)
properties and validation based on
SWIFT tags.
These two validation methods can be
combined and customized. Default
message validation can be extended
by your own specication or it can
be completely replaced. This enables
integrators to create simple business
rules being built-in the messaging
framework of the solution.
SWIFT Framework .NET
SWIFT Components
Complex SWIFT messaging
solution.
Generic system for loading, storing
and validating SWIFT messages
The object model contains 323
SWIFT Message Types
Product Top 250 Review Price
SWIFT Framework .NET - - $4,410 .00
FROM SWIFT COMPONENTS
<oXygen/> XML Editor
<oXygen/> XML Editor provides
the tools for XML authoring, XML
conversion, XML Schema, DTD, Relax
NG and Schematron development,
XPath, XSLT, XQuery debugging, SOAP
and WSDL testing.
Integration with the XML document
repositories is made through WebDAV,
Subversion and S/FTP protocols.
<oXygen/> XML editor supports the
ability to browse, manage and query
native XML and relational databases
and supports a large number of text
encodings including Unicode.
<oXygen/> XML editor is also available
as an Eclipse IDE plugin, bringing
unique XML development features to
this widely used Java IDE.
<oXygen/> XML Editor V12
SyncRO Soft
Tools for XML authoring &
conversion plus XPath, XSLT
and XQuery development.
Visual WYSIWYG XML editing mode
based on W3C CSS stylesheets
Grid editor allows you to edit
repetitive XML content in a special
layout similar to a spreadsheet
application
Product Top 250 Review Price
<oXygen/> XML E ditor Enterprise V12 39 - $440 .02
<oXygen/> XML E ditor Professional V12 149 - $342 .02
<oXygen/> XML A uthor Professional V12 - - $195 .02
<oXygen/> XML A uthor Enterprise V12 - - $263 .62
Syncro SV N C lient V5.1 - - $57 .82
FROM SYNCRO SOFT
NEW RELEASE
FinalBuilder
FinalBuilder is an automated build
and release management solution for
Windows software developers and
SCM (Software Change Management)
professionals. Use FinalBuilder to
dene, debug, maintain, run and
schedule reliable and repeatable build
processes. FinalBuilders user interface
has been carefully crafted to make it as
easy-to-use as possible. Anyone in your
team can use FinalBuilder to automate
tasks. You can compile applications
from source code, compile setup
installer programs, work with version
control systems, handle versioning
with ease, create and edit INI les
and Windows registry keys, burn CDs
and DVDs, or create CD/DVD images
(ISO images), zip and unzip les and
other archive formats, run automated
testing, FTP les to/from servers, send
emails, post on news servers, handle
errors, run multiple tasks in parallel
and dynamically change the build ow,
iterate over sets of les and other lists
and more.
FinalBuilder 7.0
VSoft Technologies
Automated build and release
management solution.
Integrates with version control
systems/Source code repositories
Includes a broad range (600+) of
action types that cover almost any
task you might need to automate
Product Top 250 Review Price
FinalBuilder 7.0 173 - $351 .82
Automise V3.0 - - $229 .32
FinalBuilder S erver 7.0 - - $117 .60
FROM VSOFT TECHNOLOGIES
USA toll free: (888) 850-9911

You might also like