Documentation Review Tool's Evolving Design

The Documentation Review Tool's initial development precedes the Windows DNA model, but anticipates many features of n-tier application development in its design. In fact, with some fairly minor modifications, it certainly can take advantage of the benefits of Microsoft Transaction Server (MTS), for example. Currently, its business-services tier uses only Internet Information Server and Active Server Pages (ASP) to handle the communication between the Internet Explorer user interface and the SQL Server database. The application does use a custom server-side Component Object Model (COM) component, the Review object, deployed as an ActiveX dynamic-link library (DLL), to implement its administration. All user functionality, however, is accessed by using calls to ActiveX Data Objects (ADO) directly from the ASP pages. Microsoft now advises against this design, and the developer of the review tool agrees that calls made to ADO from MTS business components would result in more stability and faster performance from the application.

All ASP and ISAPI applications benefit from the MTS run-time environment. Yet parts of the review tool make direct calls from ASP pages to the SQL Server database, without the benefit of a COM object to encapsulate these calls and perhaps make them transactional, or to isolate faults. To bring the application fully into compliance with the Windows DNA model, all functionality could be added to the Review object, which then would be recompiled and deployed as an MTS package using the MTS Explorer.

The application does currently use MTS implicitly. The Review object was initially compiled using the MTS type library. In addition, the Review object calls the MTS ObjectContext object to retrieve the ADO Response object and uses it to write to the response stream of the ASP page. The following code sample demonstrates how this was done from a private class called from inside the Review object:

Private Const NERR_NOOBJECT = &H800E0054
Private Const SERR_NOOBJECT = "The requested ASP object is unavailable."

Private m_oc As MTxAS.ObjectContext
Private m_rsp As ASPTypeLibrary.Response

Public Function GetObject(Name As String) As Object
    CheckContext
    On Error GoTo ErrHandler
    Set GetObject = m_oc.Item(Name)
    Exit Function
ErrHandler:
    Err.Raise NERR_NOOBJECT, "ASP.GetObject", SERR_NOOBJECT
End Function

' ==================================================================
' === Response Methods
' ==================================================================

' --- WriteLn: Writes Text followed by a CR/LF
' --- WriteBr: Writes Text followed by <BR> and CR/LF
Public Sub WriteLn(ByVal Text As String)
    CheckResponse
    m_rsp.Write Text & vbCrLf
End Sub
Public Sub WriteBr(ByVal Text As String)
    WriteLn Text & "<BR>"
End Sub

' ==================================================================
' === Private
' ==================================================================

Private Sub CheckContext()
    If m_oc Is Nothing Then Set m_oc = GetObjectContext()
End Sub

Private Sub CheckResponse()
    If m_rsp Is Nothing Then Set m_rsp = Me.GetObject("Response")
End Sub