# runWithTenantContext

**Kind:** Function

**Source:** [`atloria-monorepo/libs/database/src/lib/tenant-context.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/database/src/lib/tenant-context.ts#L30)

Run `fn` with the given tenant context bound for the duration of its async execution.

## Signature

```ts
function runWithTenantContext(context: TenantContext, fn: () => T): T
```

## Parameters

| Name | Type |
|---|---|
| `context` | `TenantContext` |
| `fn` | `() => T` |

**Returns:** `T`
