[英]Entity Framework 4 Image Type
I am using Entity Framework 4 code-first with SQL Server CE 4. 我在SQL Server CE 4中先使用Entity Framework 4代码。
What is the type I should define in the class? 我应该在课堂上定义什么类型? SQL Server CE only support Image
. SQL Server CE仅支持Image
。
Thank you. 谢谢。
You should use byte[]
in your class. 您应该在课程中使用byte[]
。
The "image" db type is a bit misleading, as it just represents arbitrary binary data (full SQL Server has deprecated it in favor of the varbinary(max)
type) “ image” db类型有点误导,因为它仅表示任意二进制数据(完整的SQL Server已弃用它,而推荐使用varbinary(max)
类型)
In your context class, you can try: 在上下文类中,您可以尝试:
modelBuilder.Entity<YourClass>().Property(x => x.YourProperty)
.HasColumnType("image").IsMaxLength();
(I don't have any SQLCE projects to try it; maybe it will work, maybe not, maybe only one of the configuration methods is enough) (我没有任何SQLCE项目可以尝试它;也许它可以工作,也许不能,也许只有一种配置方法就足够了)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.