0

查看反射器显示为的 AuthorizedChangeSet 方法

protected virtual bool AuthorizeChangeSet()
    {
        foreach (ChangeSetEntry entry in this.ChangeSet.ChangeSetEntries)
        {
            object entity = entry.Entity;
            if (entry.DomainOperationEntry != null)
            {
                this.ValidateMethodPermissions(entry.DomainOperationEntry, entity);
            }
            if ((entry.EntityActions != null) && entry.EntityActions.Any<KeyValuePair<string, object[]>>())
            {
                KeyValuePair<string, object[]> pair = entry.EntityActions.Single<KeyValuePair<string, object[]>>();
                DomainOperationEntry customMethod = this.ServiceDescription.GetCustomMethod(entity.GetType(), pair.Key);
                this.ValidateMethodPermissions(customMethod, entity);
            }
        }
        return !this.ChangeSet.HasError;
    }

当它转换为对象时,如何在 foreach 循环中访问实体对象的属性???

4

1 回答 1

0

仔细阅读,它没有。它只访问条目的成员而不是实体。另一种选择可能是 ValidateMethodPermissions 使用反射

于 2014-02-20T20:49:42.927 回答