FMStocks
Overview
The FMStocks sample consists of two sets of projects:
- FMSLib contains six inter-related VB6 libraries and one test executable
- FMSWeb contains thirty-four ASP pages, which reference the six VB6 libraries in FMSLib.
Â
The FMStocks sample shows how to migrate interrelated ASP and VB6/COM components. The application was published to demonstrate a 3-tier architecture (ASP, COM+, and SQL Server) in the context of a stock trading site with the following features:
- Portfolio Management Â
- Research/Buy/Sell Stocks Â
- On-line Store Â
- Forms-based Login
FMStocks, the Fitch and Mather Stocks 2000 sample, was created by Vertigo software and distributed through MSDN to demonstrate some of the best practices for building scaleable web applications using ASP and COM+. FMStocks was also featured in the Patterns and Practices guide as an example of how to upgrade VB6 to .NET.
It consists of seven (7) VBPs (2500 LOC)
FMStocks_DB.vbp (Data Access) FMSStore_DB.vbp (Data Access) FMSStore_Bus.vbp (Business Objects) FMStocks_Bus.vbp (Business Objects) FMSStore_Events.vbp (Business Objects) FMStocks_Ext.vbp (Business Objects) FMSTest.vbp (A Simple Desktop Application Test Harness)
and thirty-four ASP pages (2300 LOC)
ASP Pages Include files Pulp (images, css, client-side script files, etc.)
A pivot table of data produced by the Source Structure report for the FMStocks VB6 code is displayed below.
A pivot table of data produced by the Migration Set Report for the FMStocks web site is displayed below.
The migration concepts introduced in the context of the ScanTool demo also apply to ASP-to-ASP.NET translations. For the most part, these concepts are all handled the same way for ASP as they are for VB6. In fact, gmStudio compiles both VB6 and ASP codes to the same intermediate semantic model format before analyzing and restructuring them to the target architecture. However, in addition to a programming language change -- in this case VB Script to C# or VB.Net -- ASP brings several fundamental migration challenges:
- Subtle changes in the semantics of core ASP classes (Request, Response) Â
- Scoping matters relating to nested and stacked ASP include files Â
- Weak typing everywhere Â
- Various obscure differences between the syntax VBScript and Visual Basic Â
- Different rules for structuring markup and script tags Â
- Different format and semantics of ASP directives Â
- Looser coupling to COM, and Â
- Architectural decisions regarding where and how to use the many powerful new features of ASP.NET
The FMStocks sample illustrates how gmStudio handles many of these matters for you. FMStocks also provides another example of VB to .NET migration because there is a set of VB6 COM objects providing the business and data objects used by the pages.
COM Dependencies
FMStocks depends on the following external COM components that must be installed on your workstation to perform the migration successfully:
File | Description | Upgrade Strategy |
scrrun.dll | Scripting, Microsoft Scripting Runtime | Replace with System.IO |
msado27.tlb | ADODB, Microsoft ActiveX Data Objects 2.7 Library | Replace with System.Data and System.Data.SqlClient with the help of MigrationSupport.DataLib, a set of classes that implement the ADODB API in C#. MigrationSupport.DataLib is part of the sample runtime library available as source with a Professional Edition License of gmStudio. |
Note: The version of FMStocks distributed as a sample here uses COM instead of COM+.Â
Special Features: a Structural Migration
This sample illustrates the SharedFiles statement that allows placing a shared code file into a selected .NET translation and referencing its content from that location. In this example Helpers.bas is shared by several of the VB6 projects, but in the generated code, there is only one copy in a selected "host" project. The other projects reference the "host" assembly and reference the Helpers content from there. See GlobalSettings.xml script with the sample and the gmplSharedFileStatement for more information.
Deployment
The source codes for the FMSLib VB6 projects are located in the [INSTALLDIR]\samples\source\FMStocks\FMSLib subdirectory. The source code for the ASP pages is located in the [INSTALLDIR]\samples\source\FMStocks\FMSWeb\asp subdirectory. Four sample Migration Projects are included in the FMStocks example, depending on target language (C# or VB.NET) and treatment of referenced components (Interoped or migrated to .NET), as shown below:Â
Project[.gmproj] | Description |
DemoFMSLib_csh | All interrelated VB6 DLLs are migrated to C#.NET |
DemoFMSWeb_csh | ASP Site and FMSLib libraries are migrated to C#.NET |
DemoFMSLib_vbn | All interrelated VB6 DLLs are migrated to VB.NET |
DemoFMSWeb_vbn | ASP Site and FMSLib libraries are migrated to VB.NET |
The FMStocks projects have the following deployment settings:
The VB6 Projects (COM libraries): ProjectFolder = [INSTALLDIR]\samples\workspace\FMStocks_[lang] DeployFolder = %ProjFolder%\deploy\lib The ASP Projects (web site): ProjectFolder = [INSTALLDIR]\samples\workspace\FMStocks_[lang] DeployFolder = %ProjFolder%\deploy\web
Log files showing all migration steps are created in the workspace\log folders.
[INSTALLDIR]\samples\workspace\FMStocks_[lang]\log
The .NET project files are deployed to the following folders:
.NET Library Code: [INSTALLDIR]\samples\workspace\FMStocks_[lang]\deploy\lib\[project]_std_[lang] ASP.NET Site: [INSTALLDIR]\samples\workspace\FMStocks_[lang]\deploy\web where: [project] is the name of the migration unit associated with each migration task in the migration project. [lang] is "csh" or "vbn" depending on target language choice.