简体   繁体   English

Azure表InsertOrMerge Upsert:可以动态创建要合并的对象吗?

[英]Azure Table InsertOrMerge Upsert: Can the to-be-merged object be dynamically created?

I need to merge a dynamic list of properties into what is already saved in Azure table. 我需要将动态的属性列表合并到Azure表中已保存的内容中。 From my research "upsert" with "insert or merge" is the correct approach. 从我的研究中,“插入”或“插入或合并”是正确的方法。

  • How do I get the C# language to permit a dynamic list of properties to be saved? 如何获取C#语言以允许保存动态列表属性?

  • Is raw XML editing the only way to accomplish this? 原始XML编辑是完成此任务的唯一方法吗?


More information on Upsert and InsertOrMerge is available here 有关Upsert和InsertOrMerge的更多信息,请参见此处。


Additional detail on my particular issue 有关我的特定问题的其他详细信息

I am using an Entity object to track what is essentially an array of N length, where N < 240 (255 is the maximum number of properties available in Azure Table). 我正在使用一个Entity对象跟踪本质上是N长度的数组,其中N <240(255是Azure表中可用的最大属性数)。 Each position in the array corresponds with a property name like this: 数组中的每个位置都对应一个属性名称,如下所示:

 /* 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;}

}

I require the ability to match a string against any specific position of the array. 我需要能够将字符串与数组的任何特定位置进行匹配。 I plan to use projection with this. 我打算与此一起使用投影。

One issue that I forsee is that if I create a large fat object with 240 properties, then I am consuming storage bandwidth and creating inefficiencies that don't need to exist. 我预见的一个问题是,如果我创建一个具有240个属性的大型胖对象,那么我将消耗存储带宽并造成不必要的低效率。

Not to mention these additional properties, even if null, will count against my maximum entity size. 更不用说这些附加属性,即使为null,也将计入我的最大实体大小。 This is not desired since the intrinsic overhead means I'll have less room to save data for longer records. 这是不希望的,因为固有的开销意味着我将有更少的空间来保存数据以用于更长的记录。

I have written an open source client, Lucifure Stash, available on CodePlex and via NuGet, which will allow you to persist an array to Azure Table Storage, one array element per column. 我已经编写了一个开源客户端Lucifure Stash,可在CodePlex上通过NuGet获得,它将允许您将一个数组持久存储到Azure Table Storage,每列一个数组元素。

Lucifure Stash also supports dynamic properties via a dictionary and could be ideal for 'insert-merge'. Lucifure Stash还通过字典支持动态属性,可能是“插入合并”的理想选择。 ( CodePlex ) CodePlex

What it does not support is the ability to query on individual array elements. 它不支持查询单个数组元素的能力。 Please note that unless the query is bound by a tight Partition and/or Row Key range, queries on non-key elements could be inefficient. 请注意,除非查询受到严格的分区和/或行键范围的约束,否则对非键元素的查询可能会效率低下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM