public class MyService : IMyService { private readonly AbpSession _abpSession; public MyService(AbpSession abpSession) { _abpSession = abpSession; } public void DoSomethingWithTenantId() { var tenantId = _abpSession.GetTenantId(); // Do something with tenantId } }
public class TenantController : ControllerBase { private readonly AbpSession _abpSession; public TenantController(AbpSession abpSession) { _abpSession = abpSession; } [HttpGet] public ActionResultThis example shows how to use the GetTenantId method in a controller to get the Id of the current tenant and return it as a response to an API call. Package library: ABP Framework.GetTenantId() { return _abpSession.GetTenantId(); } }