linq - 将对象写入表时超过 8060 字节 - Windows Phone 7.5

标签 linq windows-phone-7

当我尝试将新对象添加到本地数据库时,我进行了以下通信:

The table definition or the row size exceeds the maximum row size of 8060 bytes.

我的表具有以下结构:

[Table]
public class SomeClass
{
    [Column(IsPrimaryKey = true, IsDbGenerated = true, CanBeNull = false, AutoSync = AutoSync.OnInsert)]
    public int Id { get; set; }
    [Column]
    public string String1 { get; set; }
    [Column]
    public string String2 { get; set; }
    [Column]
    public string String3 { get; set; }
    [Column]
    public string String4 { get; set; }
}

其中 3 个字符串(String2、String3、String4)将包含 2000-3000 个字符。 当我尝试写入较小的数据(1000 到 1500 个字符之间)时,一切正常。

我该如何解决这个问题?

最佳答案

SQL Server 将记录存储在页中,页为 8k,因此记录不能超过该大小(与 8k 的差异是管理日期)。

您需要将文本列定义更改为 textntextvarchar(max)nvarchar(max) 来存储较长的文本。这些 blob 列不受页面大小的限制。

关于linq - 将对象写入表时超过 8060 字节 - Windows Phone 7.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12873966/

相关文章:

entity-framework - 我们如何从 Telerik Open Access 切换到其他任何东西?

c# - 带有四个 && 的 LINQ Where 子句

c# - linq & distinct,实现 equals 和 gethashcode

bing-maps - 如何在 map 上制作动态圆圈?

windows-phone-7 - 了解 Windows Phone 7 开发。 (.net、c#、silverlight、xna)它们是如何相互作用的?

c# - 通配符搜索 LINQ

c# - 将 SQL 注释添加到 Linq 生成的查询,以便它在 SQL 分析器中可见

windows-phone-7 - WP7 : Edit Screenshot While App is Backgrounding (Mango)

windows-phone-7 - 以编程方式在 WP7 上显示软输入面板 (SIP)

.net - 由于命令行参数无效,连接失败