How can I add an Image type to an EF4 Code First Entity?
Asked Answered
E

2

6

How can I add an Image type to an EF4 Code First Entity? I need to add a column for thumbnail images.

public Image Thumbnail { get; set; }

Thanks!

Eliason answered 11/11, 2010 at 16:5 Comment(0)
F
9

Images are represented as binary in EF 4

http://thedatafarm.com/blog/data-access/sql-server-2008-data-types-and-entity-framework-4/

You will need to do something like this

public Binary Thumbnail {get; set}

Then convert the image to binary

This reference will help you with the image to binary conversion http://www.dotnetspider.com/resources/6150-Convert-Image-binary-format.aspx

Flexed answered 11/11, 2010 at 16:21 Comment(0)
P
2
public System.Data.Linq.Binary Thumbnail {get; set}

For those wondering where the type Binary is located, also i belive you can use byte[]

Pothook answered 17/4, 2011 at 4:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.