如何在 ObjectTypeCode 的 ConditionExpression 上传递实体的逻辑名称?

How can passing the Entity's logical name on a ConditionExpression for the ObjectTypeCode work?

我有这段代码:

new QueryExpression
{
    EntityName = "systemform",
    ColumnSet = new ColumnSet("name"),
    Criteria =
    {
        Conditions =
        {
            new ConditionExpression("objecttypecode", ConditionOperator.Equal, "account")
        }
    }
}

我可以用实体的实际 ObjectTypeCode 替换 "account",这两种方法都有效。 CRM 是否通过逻辑名称推断 ObjectTypeCode 以实现此目的?

引自MSDN

Always use the entity schema name (SchemaName) to refer to a custom entity in code and queries. Do not use the object type code (also referred to as entity type) code because tis integer value varies for custom entities in different organizations.

根据建议指南,是的,CRM 似乎确实从逻辑名称中解析了 objecttypecode,它几乎表明相反的方法(从整数值中解析 obecttypecode)可能并不总是适用于跨不同组织的自定义实体。