【问题标题】:How to check caller is EP in X++如何检查调用者是 X++ 中的 EP
【发布时间】:2014-02-13 07:41:16
【问题描述】:

如果调用者是 EP 或客户端,我需要检查 X++,因此如果调用者是该代码中的 EP,我可以进行一些自定义。请告诉我怎么可能

注意:我对 EP 和 AX 客户端都使用 ListPageInteraction 类,如果调用者是 ListPageInteraction 类中的 EP,我必须对相同的查询(用于两者)进行一些修改

【问题讨论】:

    标签: client axapta x++ dynamics-ax-2012 enterprise-portal


    【解决方案1】:

    查看 NumberSeqNumCache.isEpClient 方法,如下所示:

    /// <summary>
    ///    Determines whether the request is from EP.
    /// </summary>
    /// <returns>
    ///    true if EP is the caller; otherwise, false.
    /// </returns>
    static server boolean isEpClient()
    {
         xSession session = new xsession();
         boolean isEP = false;
         sysClientSessions clientsessions;
         ;
    
    
        select ClientType from clientsessions where clientsessions.SessionId == session.sessionId();
    
        if (clientSessions.ClientType == SessionType::WebUser || clientsessions.clientType == SessionType::Worker)
        {
             isEp = true;
        }
    
        return isEp;
    }
    

    它检查当前会话的类型是 webuser 还是 worker。如果您使用客户端,会话将是 SessionType::GUI 类型。请注意,其他会话也可能注册为 SessionType::Worker 类型,例如批处理任务,因此这可能不适用于所有地方。

    【讨论】:

    • 还要检查community.dynamics.com/ax/f/33/t/69639.aspx,他们说检查这是不可能的(据他们所知,但如果上述方法有效,那么那将被证明是错误的)。
    • 我认为上面的代码 sn-p 混淆了 clientTypes 和 sessionTypes。 sysClientSessions 表同时具有 clientType 和 sessionType。 AOT 下的基本枚举节点,系统文档具有它们的枚举值。也就是说,我不知道如何推断它是否是EP。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-25
    • 1970-01-01
    • 2018-09-17
    • 1970-01-01
    • 2011-12-07
    • 2017-03-03
    • 2018-07-16
    相关资源
    最近更新 更多