Datasheet
It is very easy to write services in C#. .NET Framework base classes are available in the System
.ServiceProcess
namespace that handle many of the boilerplate tasks associated with services, and in
addition, Visual Studio .NET allows you to create a C# Windows Service project, which uses C# source
code for a basic Windows service. Chapter 22, “Windows Services,” explores how to write C# Windows
Services.
Windows Communication Foundation (WCF)
Looking at how you move data and services from one point to another using Microsoft-based technolo-
gies, you will find that there are a lot of choices at your disposal. For instance, you can use ASP.NET Web
services, .NET Remoting, Enterprise Services, and MSMQ for starters. What technology should you
use? Well, it really comes down to what you are trying to achieve, as each technology is better used in a
particular situation.
With that in mind, Microsoft really brought all these technologies together, and with the release of the .NET
Framework 3.0, you now have a single way to move data — the Windows Communication Foundation
(WCF). WCF provides you with the ability to build your service one time and then expose this service in
a multitude of ways (under different protocols even) by just making changes within a configuration file.
You will find WCF a powerful new way of connecting disparate systems. Chapter 40, “Windows
Communication Foundation,” covers this all in detail.
The Role of C# in the .NET
Enterprise Architecture
C# requires the presence of the .NET runtime, and it will probably be a few years before most clients —
particularly most home computers — have .NET installed. In the meantime, installing a C# application is
likely to mean also installing the .NET redistributable components. Because of that, it is likely that we
will see many C# applications first in the enterprise environment. Indeed, C# arguably presents an
outstanding opportunity for organizations that are interested in building robust, n-tiered client-server
applications.
When combined with ADO.NET, C# has the ability to access quickly and generically data stores such as
SQL Server and Oracle databases. The returned datasets can easily be manipulated using the ADO.NET
object model, and automatically render as XML for transport across an office intranet.
Once a database schema has been established for a new project, C# presents an excellent medium for
implementing a layer of data access objects, each of which could provide insertion, updates, and deletion
access to a different database table.
Because it’s the first component-based C language, C# is a great language for implementing a business
object tier, too. It encapsulates the messy plumbing for intercomponent communication, leaving devel-
opers free to focus on gluing their data access objects together in methods that accurately enforce their
organizations’ business rules. Moreover, with attributes, C# business objects can be outfitted for method-
level security checks, object pooling, and JIT activation supplied by COM+ Services. Furthermore, .NET
ships with utility programs that allow your new .NET business objects to interface with legacy COM
components.
25
Chapter 1: .NET Architecture
24727c01.qxd:WroxPro 5/7/07 12:12 PM Page 25