Try OpenEdge Now
skip to main content
Programming Interfaces
Database Administration Entity Interface Reference : ITenant interface : ITenant examples : Adding tenant groups to a tenant
 
Adding tenant groups to a tenant
You can assign a tenant to one or more tenant groups by adding tenant groups to an ITenant. The following code shows how you can use the TenantGroups property to add tenant groups to the tenant:
define variable tenant as ITenant no-undo.
define variable tenantgroup as ITenantGroup no-undo.

assign
  tenant = service:GetTenant("ACME")
  tenantgroup = service:GetTenantGroup("AcmeCustomer")
  tenant:TenantGroups:Add(tenantgroup)
  tenantgroup = service:GetTenantGroup("AcmeOrder")
  tenant:TenantGroups:Add(tenantgroup).

service:UpdateTenantGroup(tenantgroup).
Note: Any ITenant that you intend to make a member of a group should be created with its DefaultAllocation property set to "Delayed" so tenant storage is not allocated in addition to the storage for the group.