You can go at this a number of ways, but here is a quick sample. Let's first put a method on the BO where the varbinary field resides:
BO Method
''' <summary>
''' Updates a blob or binary field on a thread with callback methods updating the progress
''' </summary>
Public Sub UpdateBlobData(ByVal pk As Integer, _
ByVal data As Byte(), _
ByVal displayText As String, _
ByVal progressCallback As BlobProgressDelegate, _
ByVal completeCallBack As BlobPushCompleteDelegate, _
ByVal errorCallback As BlobErrorDelegate)
'-- Establish Locals
Dim pkValue As New MicroFour.StrataFrame.Business.PrimaryKeyValue(New Object() {pk})
'-- Start the update progress
Me.PushBlobFieldAsync(pkValue, _
"FieldName", _
data, _
84000, _
displayText, _
progressCallback, _
completeCallBack, _
errorCallback)
End Sub
In this example, the above field name is "FieldName" so we would add "FieldName" to the FieldsToExcludeFromUpdate and FieldsToExcludeFromInsert. This way the PK, time stamp columns, etc. would save before we try to save our blob data. So taking this example, and assuming that you have added the "FieldName" to the FieldsToExclude properties on the BO, the code would look something like this:
'-- Save the BO data to the server minus the blob field. The Blob field will not be included because
' it should have been added to the FieldsToExcludeFrom... properties.
MyBO.Save()
'-- Now that all other fields of the BO have been saved, it is time to save the blob data
MyBO.UpdateBlobData(MyBO.PrimaryKeyField, _
BlobDataAsByteArray, _
"Saving large data", _
AddressOf HandlePushProgress, _
AddressOf HandlePushComplete, _
AddressOf HandlePushError)
''' <summary>
''' Handles the completion of a push of a media item to the serve
''' </summary>
Private Sub HandlePushComplete(ByVal state As Object)
'-- Place any post push logic here (i.e. update the dialog, start a new update, etc.)
End Sub
''' <summary>
''' Handles an error in the push process
''' </summary>
Private Sub HandlePushError(ByVal ex As Exception, ByVal state As Object)
MicroFour.StrataFrame.Application.StrataFrameApplication.ShowRedExceptionDialog(ex)
End Sub
''' <summary>
''' Handles the progress of an upload or download from the server
''' </summary>
Private Sub HandlePushProgress(ByVal currentCount As Long, ByVal totalCount As Long, ByVal nextIncrement As Byte(), ByVal state As Object)
'-- Update the progress
lblProgress.Text = CType(state, String)
'-- Update the thermo
Try
'-- Don't let the progress go above the max value
If prgProgress.Value > totalCount Then prgProgress.Value = totalCount
prgProgress.Maximum = totalCount
prgProgress.Value = currentCount
Catch ex As Exception
End Try
End Sub
That should give you a good starting point.