Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Visual Basic 6 MTS Programming


Message #1 by Rowenap@w... on Thu, 24 Aug 2000 11:50:8
-----Original Message-----
From: Michael Melio [mailto:michaelmelio@c...]
Sent: 23 August 2000 22:19
To: support@w...
Subject: re: ISBN: 1861002440 


To Matthew Bortniker:

Regarding your insightful book:
Professional Visual Basic 6 MTS Programming
ISBN: 1861002440 


I'm on assignment with a major Insurance company that has asked me to
assess the migration from a 2-tier to an N-Tier Client / Server 
application
using MTS (divided into Presentation Logic, Business Logic, Data Logic,
Data Store) -- with the Presentation tier to be IE4.x. The existing 2-tier
app has been designed in classic component design fashion: class modules
modelled after an Oracle database with methods like Update, Delete, Add 
and
loads of Properties (each representing the table attributes/columns).

There are a total of 61 class modules (one module for each table in the
data stores) in the main (Business) DLL. There are 2 other DLLs: both for
the Data Access layer (one to connect to a File Server the other to
Oracle). ADO is used for all the connections. The previous programmers
elected to dynamically build thier SQL statements by directly reading the
DDL of the data stores (this is not a business requirement, just a
preference. I would prefer the more efficient method of using stored
procedures). Moreover, the data access layer uses generic Update, Add,
Delete, and browse routines for all requests (the calling routine provides
tablename, keyid field, and collection of fields to be viewed). The data
component passes back a collection 

My questions are regarding state: 

1.	The main Business layer, having 61 classes, instantiates objects and
then relies on the persistance of the properties to achieve it's work,
somewhat like the following:

Public Function GetRows( _
    ByVal v_strTable As String, _
    ByVal v_strKeyField As String, _
    Optional ByVal v_objFilters As clsFields, _
    Optional ByVal v_blnLockRecords As Boolean) As Collection

    If Not IsConnected Then OpenConnection (True)

    ' the fetch flag is only valid for static connections, reset it to
false if this
    ' is a temporary connection, unless within a transaction
    If v_blnLockRecords And m_blnTempConnect And Not m_blnTrans Then
        v_blnLockRecords = False
    End If
    If Not v_objFilters Is Nothing Then
        strSQL = strSQL & BuildWhereClause(v_objFilters)
    End If
    
    ' initialize a recordset and use the open method of the recordset to
execute 
	' the query
    Set m_rsRecordSet = New ADODB.Recordset
    With m_rsRecordSet
        ' set the cursor type and maxrows
        .CursorType = adOpenKeyset
        .MaxRecords = m_lngMaxRows
        ' set the lock type based on the lock flag
        .LockType = IIf(v_blnLockRecords, adLockPessimistic,
adLockReadOnly)
        .Open strSQL, m_cnnOracle
    End With


In the above example, the module level variables, m_blnTempConnect And
m_blnTrans,  are set by the routine that instantiates this class. Will 
this
work in MTS? Will the values of m_blnTempConnect And m_blnTrans be assured
to be accurate across multiple user calls?

This leads to a another question I have regarding state and persistence:

2. 	Does it matter for MTS that clsOne.method1 references 
clsTwo.property1?
	In other words, does the MTS preference for stateless design apply only 
to
web pages? 

Somewhat perplexed.

Michael Melio

michaelmelio@c...


  Return to Index