Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Microsoft在Azure:Table​;操作​;合并方法_Azure_Asp.net Core_Msdn_Azure Table Storage_Microsoft Documentation - Fatal编程技术网

Microsoft在Azure:Table​;操作​;合并方法

Microsoft在Azure:Table​;操作​;合并方法,azure,asp.net-core,msdn,azure-table-storage,microsoft-documentation,Azure,Asp.net Core,Msdn,Azure Table Storage,Microsoft Documentation,我是Azure的新手,所以我读了微软 创建一个新的表操作,该操作合并给定 具有表中现有实体的实体 就这些。。。现在,我应该从“合并”概念中理解什么?这种合并是如何发生的 说我有 Body {PK: b, RK: 1, LeftHand: null, RightHand: 1000, LeftLeg: ll} > Body {PK: b, RK: 1, LeftHand: 9999, RightHand: null, Head: h} 空/空值会发生什么情况 如果找不到该项目,会发生什么

我是Azure的新手,所以我读了微软

创建一个新的表操作,该操作合并给定 具有表中现有实体的实体

就这些。。。现在,我应该从“合并”概念中理解什么?这种合并是如何发生的

说我有

Body {PK: b, RK: 1, LeftHand: null, RightHand: 1000, LeftLeg: ll} >
Body {PK: b, RK: 1, LeftHand: 9999, RightHand: null, Head: h}
  • 空/空值会发生什么情况
  • 如果找不到该项目,会发生什么情况
  • 我应该期待什么样的例外
  • InsertOrMerge和Merge之间有什么区别

我怎么猜呢?

合并操作实际上创建了一个超集。简言之:

  • 如果旧实体没有属性,而新实体有:结果实体将具有该新属性
  • 如果旧实体有属性而新实体没有:该属性的值将不会更改。它将与旧值相同
  • 如果旧实体具有属性,而新实体也具有该属性:结果实体将替换属性值
在你的例子中:

旧实体:

{PK: b, RK: 1, LeftHand: null, RightHand: 1000, LeftLeg: ll}
{PK: b, RK: 1, LeftHand: 9999, RightHand: null, Head: h}
{PK: b, RK: 1, LeftHand: 9999, RightHand: 1000, LeftLeg: 11, Head: h} 
新实体:

{PK: b, RK: 1, LeftHand: null, RightHand: 1000, LeftLeg: ll}
{PK: b, RK: 1, LeftHand: 9999, RightHand: null, Head: h}
{PK: b, RK: 1, LeftHand: 9999, RightHand: 1000, LeftLeg: 11, Head: h} 
合并操作后的实体:

{PK: b, RK: 1, LeftHand: null, RightHand: 1000, LeftLeg: ll}
{PK: b, RK: 1, LeftHand: 9999, RightHand: null, Head: h}
{PK: b, RK: 1, LeftHand: 9999, RightHand: 1000, LeftLeg: 11, Head: h} 

好的,但是如果没有旧的实体会发生什么呢?我如何强制右侧为null或删除头部?通过替换,我猜?如果你对一个不存在的实体进行
合并
,你会得到一个错误(我想是409)。不确定您是否阅读过RESTAPI文档,但我建议您阅读以下内容:。这要复杂得多,所以您使用的SDK本质上是我链接的RESTAPI上的包装器。SDK进行RESTAPI调用。我建议将其移动到聊天室,或者发布新问题。这已经变成了评论中的讨论,这里隐藏了大量额外的信息。