Following this initial thread I'm having some problems implementing what was suggested here:
Can I Store An ArcObject inside a BLOB?
Well, following the link Kirk provided, I've came up with this:
public static object GetBlobValue(this IActiveRecord wrapper,FieldAttribute attribute)
{
IMemoryBlobStream blobStream = wrapper.UnderlyingObject.get_Value(attribute.Index) as IMemoryBlobStream;
IPersistStream blob = new PropertySetClass();
blob.Load(blobStream);
return blob as IPropertySet;
}
public static void SetBlobValue(this IActiveRecord wrapper,FieldAttribute attribute,object value)
{
if (!(value is IPersistStream))
throw new ActiveRecordException("Nâo é possível persistir um objeto que não implementa IPersistStream.");
IPropertySet property = new PropertySetClass();
property.SetProperty(attribute.FieldName, value);
IMemoryBlobStream memStream = new MemoryBlobStreamClass();
IPersistStream persist = (IPersistStream)property;
persist.Save(memStream, 0);
wrapper.UnderlyingObject.set_Value(attribute.Index, memStream);
}
Looks like the SetValue code is working. I can see the values in Oracle just fine. But the GetValue method always returns an empty IPropertySet.
I've decided to always wrap an object within the IPropertySet as recommended. I'm not sure what I might be doing wrong, since ESRIs documentation on this is sparse not very detailed.
I've followed tons of examples (tried using IObjectStream, setting IObjectStream.Stream property with IMemoryBlobStream as described here) but no luck. Always an empty IPropertySet. Oh, also I've should mention that I'm trying to persist another IPropertySet to this field - could that be the problem?
Thanks!