如何使用实体框架代码首先存储图像CTP 5? [英] How to store images using Entity Framework Code First CTP 5?
问题描述
您不能在EF中使用SQL FILESTREAM
。 EF应该在不同的数据库服务器之上工作,但是filestream功能是SQL 2008和更高版本的特定功能。您可以尝试旧的方式 - 在数据库表中使用 varbinary(max)
,并在映射类中使用字节数组。
编辑:
一点澄清 - 您可以使用 FILESTREAM
数据库,但EF不会利用流。它将作为标准 varbinary(max)
加载。
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, but I'm really just looking for some way to make it work.
You can't use SQL FILESTREAM
in EF. EF is supposed to work on top of different database servers but filestream feature is specific feature of SQL 2008 and newer. You can try to do it old way - use varbinary(max)
in your database table and use byte array in your mapped class.
Edit:
Little clarification - you can use FILESTREAM
in the database but EF will not take advantage of streaming. It will load it as standard varbinary(max)
.
这篇关于如何使用实体框架代码首先存储图像CTP 5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!