本文介绍了是目标始终是一个实体还是它可以是EntityReference?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现在我的某些代码中,我具有以下语法来保护插件免受FUBARing的侵害.我不能为了上帝的爱而忘记了为什么我把 EntityReference 的条件作为条件.

I discovered that in some of my code I have the following syntax guarding the plugin from FUBARing. I can't for the love of god not remember why I put the disjuction conditional for EntityReference.

每个 EntityReference Context.InputParameters ["Target"] 吗?

bool goodToGo
  = Context.InputParameters.Contains("Target")
    && Context.PrimaryEntityName == "email";
    && (
      Context.InputParameters["Target"] is Entity
      || Context.InputParameters["Target"] is EntityReference);

除了实体以外,是否没有其他?

推荐答案

目标也可以是来自MSDN的EntityReference:

Target can be also an EntityReference, from MSDN:

了解传递给插件的数据上下文

因此,根据插件的逻辑,您可能还需要检查 EntityReference 的属性类型.

So depending on the logic of your plugin you may need to check the property type also for EntityReference.

这篇关于是目标始终是一个实体还是它可以是EntityReference?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:08
查看更多