Docs
Tenantry CoreAPI reference

ITenantScoped<TKey> interface

Namespace: Tenantry.Core · Package: Tenantry.Core · API reference

Marker interface for objects that belong to a specific tenant. Implement this interface on any object that the tenant should isolate.

When using the Tenantry EF Core integration, the TenantId property will be automatically set by an interceptor on SaveChanges. No entity is saved to the wrong tenant. No base class is required.

public interface ITenantScoped<TKey> where TKey : IEquatable<TKey>, IParsable<TKey>

Type parameters

  • TKey: The tenant identifier type. Must match the TKey used in the rest of the Tenantry registration (e.g. Guid, string).

Derived types: TenantScoped<TKey>.

Properties

TenantId

The identifier of the tenant that owns this entity. This value is automatically set by the interceptor on SaveChanges.

TKey TenantId { get; set; }

Value: TKey

On this page