Tip 7: Improving DataSet Remoting Performance in Visual Studio 2005
Many data-driven applications pass DataSets from one physical boundary to another. Because DataSets contain a large amount of overhead, developers often convert them to or from XML strings to reduce the transfer overhead.
Fortunately, Visual Studio 2005 improves performance by allowing developers to serialize DataSets as binary files.
Tip 8: Building a Windows Service
Tip 7 presented the code from a basic Windows form application to listen for remote calls. In reality, most installations run a listener as a Windows service.
Visual Studio 2003 and Visual Studio 2005 both allow you to build Windows services. Some developers characterize the process as "so simple that it's scary." Although you need to know a little about setting up the entities of a service (the process installer, etc.), fortunately, there's a large amount of online information about building Windows services in .NET.
The download for this article contains a separate project for a Windows service.
Tip 9: New Security Enhancements for TCP Remoting in Visual Studio 2005
In Visual Studio 2003, you had to host HTTP remoting objects under IIS to gain any measure of security. Visual Studio 2005 contains enhancements to the TCP channel, so that you can configure secure TCP communications. Specifically, TCP remoting supports encryption and authentication using Security Support Provider Interface (SSPI).
|Challenge yourself and your colleagues to use strongly typed elements as much as possible, using reflection only when necessary.|
On the client piece, you can define a simple collection containing all the necessary security settings and then pass the collection to the constructor of the TCP channel:
Dictionary<string, string> oDict =
new Dictionary<string, string>();
TcpChannel oChannel =
new TcpChannel(oDict, null, null);
On the server side, you need to set the second parameter (ensureSecurity
) to true:
Tip 10: An Overview of Generics
Tcps = new TcpServerChannel(nTCPPort);
Generics are one of the hottest new language features in Visual Studio 2005. Generics are often described in terms of what the previous version of .NET didn't support. A common example is collections, where you stored references to any type of object and then performed a cast to retrieve the actual value of an index within the collection. Unfortunately, you surrender the element of compile-time type safety, and this casting incurs a small performance penalty because of the boxing and unboxing that occurs.
The new Visual Studio 2005 namespace Systems.Generic.Collections allows a developer to create a collection and specify the permitted member types; consequently, the compiler only permits you to add objects of the types previously declared. You no longer need to perform cast operations to retrieve a value from a collection.
At the MSDN CodeCamp in New Jersey last fall, Carl Franklin gave one of the best short explanations of generics that I've heard (see www.DotNetRocks.com
). He said: "Generics are a great way to simplify multiple classes that differ by an internal type." This is a segue to my next tip.