Dear Alex, i want to store Image as byte stream in db and hence i want to keep a property with Image datatype ,but it seems not supported.

any help much appreciated. Thanks


Updated at 14.07.2010 10:30:06

aah great!!! this should work. Thanks

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 14 '10 at 07:15

HannanKhanji's gravatar image

HannanKhanji
54141317

Use byte[] type

(Jul 14 '10 at 07:15) xumix xumix's gravatar image

One Answer:

You can provide non-persistent property of image type wrapping low-level byte[] type like here:

[Field]
private byte[] ImageData { get; set; }

// No [Field]
public Image Image { 
  get { return Deserialize(ImageData); }
  set { return ImageData = Serialize(value); }
}

Of course, this is just an example. Ideally, it's better to cache deserialized image as well to avoid frequent deserialization.

answered Jul 14 '10 at 17:36

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

Any way we can support this natively, as was available in DO 3.9?

(Dec 30 '10 at 03:48) ara ara's gravatar image

Unfortunately, DataObjects.Net 4.3/4.4 doesn't support the Image type natively yet. I hope, we'll add the feature to automatically store and fetch objects of any serializable types in future versions.

(Dec 30 '10 at 09:44) Dmitri Maximov Dmitri%20Maximov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×574

Asked: Jul 14 '10 at 07:15

Seen: 4,142 times

Last updated: Dec 30 '10 at 09:44

powered by OSQA