如何将图像类型添加到EF4代码第一实体? [英] How can I add an Image type to an EF4 Code First Entity?
本文介绍了如何将图像类型添加到EF4代码第一实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将图像类型添加到EF4代码第一实体?我需要为缩略图添加一列。
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; }
谢谢!
推荐答案
图像在EF 4中以二进制表示
Images are represented as binary in EF 4
http://thedatafarm.com/blog/data-access/sql-server-2008-data-types-and-实体框架4 /
你将需要这样做
public Binary Thumbnail {get; set}
然后将图像转换为二进制
Then convert the image to binary
此参考将帮助您将图像转换为二进制转换 http: //www.dotnetspider.com/resources/6150-Convert-Image-binary-format.aspx
This reference will help you with the image to binary conversion http://www.dotnetspider.com/resources/6150-Convert-Image-binary-format.aspx
这篇关于如何将图像类型添加到EF4代码第一实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文