How to add image type to EF4 Code First Entity?

How to add image type to EF4 Code First Entity? I need to add a column for thumbnails.

public Image Thumbnail { get; set; } 

Thanks!

+6
entity-framework entity-framework-4
source share
2 answers

Images are presented 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 link will help you convert the image to binary conversion http://www.dotnetspider.com/resources/6150-Convert-Image-binary-format.aspx

+9
source share
 public System.Data.Linq.Binary Thumbnail {get; set} 

For those who wonder where the Binary type is, I also believe that you can use byte[]

+2
source share

All Articles