我目前正在开发一个采用各种不同代码方面的系统。我们有一个用VB编写的后端工作代码,我们需要将其发送到Azure等实时平台。这需要作为一个函数访问,该函数可以将一系列基本级别值返回到可以在应用程序和Web平台中显示这些值的前端代码。
我们尝试托管的代码看起来像这样(这只是一段非常大的代码的一小部分):
Sub InitialiseCalendarArray()
'This initialises the names of the 4 sessions and the cleans out and initialises the student calendar array
'NOTE - The InitialiseWeekInfoArray routine must be called before this routine otherwise some of the data will not be available
Dim cnDb As OleDbConnection
Dim strSQL As String
Dim TransferOLECommand As OleDbCommand
Dim DbReader As OleDbDataReader
Dim intWeek As Integer
Dim intWeekDay As Integer
Dim intDay As Integer
Dim intSession As Integer
garr_strSessionNames(1) = "Morning"
garr_strSessionNames(2) = "Midday"
garr_strSessionNames(3) = "Afternoon"
garr_strSessionNames(4) = "Evening"
For intWeek = 1 To gc_intNumWeeks
For intWeekDay = 1 To 7
intDay = (intWeek - 1) * 7 + intWeekDay
For intSession = 1 To 4
garr_udtStudentCalendarDay(intDay, intSession).g_intWeek = intWeek
garr_udtStudentCalendarDay(intDay, intSession).g_blnWeekday = f_blnIsWeekday(intDay)
garr_udtStudentCalendarDay(intDay, intSession).g_blnPaper = False
garr_udtStudentCalendarDay(intDay, intSession).g_blnStudy = False
garr_udtStudentCalendarDay(intDay, intSession).g_blnSplitSession = False
garr_udtStudentCalendarDay(intDay, intSession).g_blnExam = False
garr_udtStudentCalendarDay(intDay, intSession).g_blnFilled = False
garr_udtStudentCalendarDay(intDay, intSession).g_blnFixed = False
garr_udtStudentCalendarDay(intDay, intSession).g_strDisplayText = ""
garr_udtStudentCalendarDay(intDay, intSession).g_intSubjectNumber = 0
garr_udtStudentCalendarDay(intDay, intSession).g_intNumEveningSessionsLeft = 0
garr_udtStudentCalendarDay(intDay, intSession).g_intNumStudySessionBlocksLeft = 0
If f_blnIsWeekday(intDay) Then
garr_udtStudentCalendarDay(intDay, intSession).g_intMaxStudySessionBlocks = garr_udtWeekInfo(intWeek).g_intNumStudySessionBlocksWeekday
Else
garr_udtStudentCalendarDay(intDay, intSession).g_intMaxStudySessionBlocks = garr_udtWeekInfo(intWeek).g_intNumStudySessionBlocksWeekend
End If
Next
Next
Next
cnDb = Nothing
Call f_blnOpenDBConnection(cnDb, True, True)
strSQL = "SELECT * FROM NumEveningSessions ORDER BY WeekNumber"
'Run the command
TransferOLECommand = New OleDbCommand(strSQL, cnDb)
'Send the CommandText to the connection, and then build an OleDbDataReader forward-only.
DbReader = TransferOLECommand.ExecuteReader()
Do While (DbReader.Read())
For intDay = DbReader("WeekNumber") * 7 - 6 To DbReader("WeekNumber") * 7
garr_udtStudentCalendarDay(intDay, 4).g_intNumEveningSessionsLeft = f_intGetProjectedValue(DbReader("MinNumberEveningSessionBlocks"), DbReader("MaxNumberEveningSessionBlocks"), g_intEffort) 'number of evening sessions for this week and level
Next
Loop
DbReader.Close()
Call CloseDBConnection(cnDb)
End Sub
我们的系统需要一个数据库来使用一系列复杂的函数从信息中提取信息并对其进行操作。
我们需要做什么样的转换以及我们如何将其作为一个功能托管,Azure上的虚拟机是否是最简单的方法?