【问题标题】:How can I add an Image type to an EF4 Code First Entity?如何将图像类型添加到 EF4 代码优先实体?
【发布时间】:2011-05-08 13:42:50
【问题描述】:

如何将图像类型添加到 EF4 代码优先实体?我需要为缩略图添加一列。

public Image Thumbnail { get; set; }

谢谢!

【问题讨论】:

    标签: entity-framework entity-framework-4 ef4-code-only


    【解决方案1】:
    public System.Data.Linq.Binary Thumbnail {get; set}
    

    对于那些想知道Binary 类型在哪里的人,我相信你也可以使用byte[]

    【讨论】:

      【解决方案2】:

      图像在 EF 4 中表示为二进制

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

      你需要做这样的事情

      public Binary Thumbnail {get; set}
      

      然后将图像转换为二进制

      此参考将帮助您将图像转换为二进制http://www.dotnetspider.com/resources/6150-Convert-Image-binary-format.aspx

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-02-25
        • 2023-04-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-05-18
        • 1970-01-01
        相关资源
        最近更新 更多