gpt4 book ai didi

c# - Azure 表 InsertOrMerge 更新插入 : Can the to-be-merged object be dynamically created?

转载 作者:太空宇宙 更新时间:2023-11-03 16:27:19 25 4
gpt4 key购买 nike

我需要将动态属性列表合并到已保存在 Azure 表中的内容中。根据我的研究,“upsert”和“insert or merge”是正确的方法。

  • 如何让 C# 语言允许保存动态属性列表?

  • 原始 XML 编辑是完成此任务的唯一方法吗?


More information on Upsert and InsertOrMerge is available here


关于我的特定问题的更多细节

我正在使用 Entity 对象来跟踪本质上是 N 长度的数组,其中 N < 240(255 是 Azure 表中可用属性的最大数量)。数组中的每个位置都对应一个属性名称,如下所示:

 /* Note: Each number is prefixed by "a" since properties can't start with a number and I like it when all properties have the same length */

public class MyFatEntity
{

public string A01 {get;set;}

public string A02 {get;set;}

// ..

public string A10 {get;set;}

// ..

public string AF0 {get;set;}

}

我需要能够将字符串与数组的任何特定位置进行匹配。我打算对此使用投影。

我预见到的一个问题是,如果我创建一个具有 240 个属性的大型胖对象,那么我将消耗存储带宽并造成不需要存在的低效率。

更不用说这些额外的属性,即使为空,也会计入我的最大实体大小。这是不希望的,因为固有的开销意味着我将有更少的空间来保存更长记录的数据。

最佳答案

我编写了一个开源客户端 Lucifure Stash,可在 CodePlex 和 NuGet 上使用,它允许您将数组持久保存到 Azure 表存储,每列一个数组元素。

Lucifure Stash 还通过字典支持动态属性,可能是“插入-合并”的理想选择。 ( CodePlex )

它不支持查询单个数组元素的能力。请注意,除非查询受严格的分区和/或行键范围约束,否则对非键元素的查询可能效率低下。

关于c# - Azure 表 InsertOrMerge 更新插入 : Can the to-be-merged object be dynamically created?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12159137/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com