I have an image in my database, I setup the business object mapper with CustomObject Type = System.Drawing.Bitmap and the flag serialize to true, null value option= don't allow null. I rebuild and get the following working code:
Set(ByVal value As System.Drawing.Bitmap)
Dim loStream As New MemoryStream()
Me.BinaryFormatter.Serialize(loStream, value)
Me.CurrentRow.Item("Immagine") = loStream.ToArray()
End Set
When I change the option null value option= return alternate on null/Set null on alternate(reference type) the code generated is the following:
Set(ByVal value As System.Drawing.Bitmap)
Dim loStream As New MemoryStream()
if value IsNot Nothing Then
Me.CurrentRow.Item("Immagine") = loStream.ToArray()
Else
Me.CurrentRow.Item("Immagine") = DBNull.Value
End If
End Set
It seems that the row
Me.BinaryFormatter.Serialize(loStream, value)
gets missing. In fact I added it manually and all works fine.
Is there a better way to achieve this? Is this by design?
Thanks in advance