How to store images using Entity Framework Code First CTP 5?

前端 未结 3 1075
遥遥无期
遥遥无期 2020-12-02 07:42

I\'m just trying to figure out if there is a simple way to store and retrieve binary (file) data using EF Code First CTP 5? I would really like it to use the FILESTREAM type

3条回答
  •  悲&欢浪女
    2020-12-02 08:37

    I always create another class like ProductImage with a one-to-one association in order to manage lazy loading and also to normalize the table:

    public class ProductImage
    {
        public int ProductId { get; private set; }
        public byte[] Image { get; set; }
    }
    

提交回复
热议问题