# FixedTenantContext

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.fixedtenantcontext/
> Summary: FixedTenantContext: An immutable tenant context that always returns the same tenant.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Core.dll</code></div>

An immutable tenant context that always returns the same tenant.

```csharp
public sealed class FixedTenantContext : ITenantContext
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.fixedtenantcontext/">FixedTenantContext</a></dd><dt>Implements</dt><dd><a href="/api/tracon.itenantcontext/">ITenantContext</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

In-memory stores read the tenant through [ITenantContext](/api/tracon.itenantcontext/).
When a store is created outside DI directly with `new`, this type supplies the
context if one is not provided, and the store behaves as single tenant.

Making a store tenant context *optional* does not make filtering optional.
A context always exists. Its value is simply fixed when it is not supplied.
Filtering occurs in every code path.

## Constructors

### <a id="Tracon_FixedTenantContext__ctor_System_String_"></a> FixedTenantContext\(string\)

An immutable tenant context that always returns the same tenant.

```csharp
public FixedTenantContext(string tenantId)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant identifier to return.

#### Remarks

In-memory stores read the tenant through [ITenantContext](/api/tracon.itenantcontext/).
When a store is created outside DI directly with `new`, this type supplies the
context if one is not provided, and the store behaves as single tenant.

Making a store tenant context *optional* does not make filtering optional.
A context always exists. Its value is simply fixed when it is not supplied.
Filtering occurs in every code path.

## Properties

### <a id="Tracon_FixedTenantContext_Default"></a> Default

The shared instance that carries the default value of
[TraconOptions.DefaultTenantId](/api/tracon.traconoptions/#Tracon_TraconOptions_DefaultTenantId).

```csharp
public static FixedTenantContext Default { get; }
```

#### Property Value

 [FixedTenantContext](/api/tracon.fixedtenantcontext/)

### <a id="Tracon_FixedTenantContext_TenantId"></a> TenantId

The current tenant's identifier. Never returns empty.

```csharp
public string TenantId { get; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

#### Remarks

**The value must be canonical** — the form
[AmbientTenantScope.Normalize](/api/tracon.ambienttenantscope/#Tracon_AmbientTenantScope_Normalize_System_String_) returns. The tenant
identifier is matched case-insensitively across the product, and every
layer achieves that by normalizing the value rather than by comparing
case-insensitively. An implementation that returns `Acme` where
another path resolves `acme` splits one tenant into two on
PostgreSQL and SQLite, and merges them on SQL Server's default
collation — the authorization layer and the storage layer then disagree.
