\t\t不同的services之间的调用

本文讨论了如何在不同服务之间进行调用,并利用会话管理来确保用户身份验证的安全性和一致性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

不同的services之间调用是有可能,如我们封装了DBSerives,而LoginServices也相对独立,但初次校验Session的用户账号和密码,有可能使用到DBSerives的方法。

我在新闻组看到RO的一个范例,代码如下:

Provided that

- you have 3 services (srvcLogin, srvcOne, srvcTwo)
- these three are connected to a SessionManager
- srvcOne and srvcTwo have RequiresSession = true
- session was initialized with a call to srvcLogin


you can call srvcTwo.CalledBySrvcOne via srvcOne.CallSrvcTwo:

procedure TsrvcOne.CallSrvcTwo;
var
instance: IInterface;
factory: IROClassFactory;
srvc2: IsrvcTwo;
begin
factory := GetClassFactory('srvcTwo');
try
    factory.CreateInstance(Session.SessionID, instance);
    if (Supports(instance, IsrvcTwo, srvc2)) then
      srvc2.CalledBySrvcOne;
finally
    factory.ReleaseInstance(Session.SessionID, instance);
end;
end;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值