December 10, 2002

Select the transaction isolation level and timeout in a serviced component

Writing a transactional COM+ component with VB.NET is as simple as applying the Transaction attribute to a class that inherits from System.EnterpriseServices.ServicedComponent: Imports System.EnterpriseServices< Transaction()> Public Class BankTransfer Inherits ServicedComponent ‘ …End Class If you don’t pass any argument to the attribute’s constructor, the class is marked as requiring a

Disable COM+ 1.5 applications and components

COM+ 1.5 (provided with Windows XP) has an interesting feature that is missing in COM+ 1.0: the ability to disable entire COM+ applications or just their individual components. You can disable and re-enable a COM+ application or component by right-clicking on it in the Component Services MMC explorer and selecting

Improve availability by running a COM+ app as an NT service

COM+ 1.5 has the ability to run any server application as a NT service, so that the application is up and running when the machine reboots, before any client makes the first requests. This improves the response time of the COM+ application. Besides, running a COM+ app as a service

Support COM+ constructor strings in serviced components

Having a VB6 component support a COM+ construction string requires that you implement the IObjectConstruct interface and its only method, Construct. The .NET ServicedComponent class implements this interface internally and expose the Construct method as a protected, overridable method. Thus your VB.NET component can learn what constructor string has been

Take advantage of COM+ object pooling

VB6 objects can’t be pooled under COM+, because they are apartment threaded. This restriction is void with VB.NET objects (and all .NET objects in general), because they are free-threaded. To make an object poolable you just need to decorate the class with the ObjectPooling attribute: Imports System.EnterpriseServices Public Class BankTransfer

Write a Generic Function that Takes Variable Datatype Parameters

To write a function like swap(datatype1, datatype2) that will take any two datatypes in its parameter and swap their values, use function templates.For example, to implement a generic swap function: //declare the functiontemplate void swap(T &a, T &b){ //decleare a temporary placeholder T temp; temp = a; a = b;

Avoiding Recursive Header Includes

In C/C++ header files, it’s often necessary to include the header files of sub classes or classes which are used. For example: #include “a.h”

Using Prototypes Rather than RTTI

In some situations, you may want a certain data member of two different objects to be identical. For example, suppose you are writing a graphics program that will render a 3D scene, you need to store material properties (such as reflection coefficients) for different objects in the scene. The simplest

Avoid Redundant Function Prototypes

In common top-down C/C++ programming, the main() function is written first, and then the functions that it calls, and then in turn the functions those functions call. For relatively small programs, or modules with static functions, the called functions can or must be contained in the same source code file

No more posts to show