c# - Entity Framework 4.1 和 BLOB

标签 c# entity-framework entity-framework-4.1

我正在尝试找出使用 BLOB 和 Entity Framework 的最佳方式。

我正在使用 EF 4.1,并使用 POCO 的/DbContext

下面是示例表:

MyTable
Key int
SomeFields ...
ABlob  (ok, it's actually a Text, but whatever)

现在,有时当我从 MyTable 中进行选择时,我想包括 BLOB 字段,但很多时候我不想。

另外,有时,当我更新 MyTable 时,我想更新 BLOB。但很多时候,我没有。

我可以为选择操作使用匿名类型,但我似乎无法找到一种方法来使这项工作完全用于更新(我不能将同一上下文中的 2 个不同类映射到同一个表,如果我尝试使用继承,我收到运行时错误,因为 EF 需要鉴别器列)。

当然,使用 EF 并不意味着我总是必须查询我的所有 BLOB。我在这里缺少什么?

最佳答案

这可以使用表拆分来完成。 EF 4.1EF 4 .

关于c# - Entity Framework 4.1 和 BLOB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9088569/

相关文章:

c# - IO 异常 : directory name is invalid using directory from File System Watcher OnChanged Event

c# - 是否可以仅使用 C# 以编程方式生成 X509 证书?

c# - Entity Framework 包含 where 子句

c# - 保存单个实体而不是整个上下文

asp.net - 无法加载文件或程序集“MySql.Data,版本=6.3.6.0”

c# - 使用 ItemsSource 和 ItemTemplate 的 WPF 列表框

c# - 通过反射找到实现通用接口(interface)的类型

c# - 使用 ExecuteSqlCommand 从存储过程中获取返回值(使用 Entity Framework )

c# - EF 4.1 和 "Collection was modified; enumeration operation may not execute."异常

c# - 如何计算 Entity Framework 中的非原始对象列表?