我发现,在我的一些代码中,我有以下语法来防范FUBARing中的插件。我不能因为上帝的爱而不记得为什么我要为EntityReference设置脱衣条件。
Context.InputParameters是每一个EntityReference的“目标”
bool goodToGo
= Context.InputParameters.Contains("Target")
&& Context.PrimaryEntityName == "email";
&& (
Context.InputParameters["Target"] is Entity
|| Context.InputParameters["Target"] is EntityReference);除了实体以外,还有什么吗?
发布于 2013-03-25 11:00:04
目标也可以是EntityReference,来自MSDN:
注意,并非所有请求都包含一个类型为实体的Target属性,因此您必须查看每个单独的请求或响应。例如,DeleteRequest确实有一个Target属性,但它的类型是EntityReference。
Understand the Data Context Passed to a Plug-In
因此,根据插件的逻辑,您可能还需要检查EntityReference的属性类型。
https://stackoverflow.com/questions/15613026
复制相似问题