Class TenantIsolationViolationException
Thrown when an operation addresses data belonging to a different tenant than the one in scope.
public sealed class TenantIsolationViolationException : InvalidOperationException, ISerializable
- Inheritance
-
TenantIsolationViolationException
- Implements
- Inherited Members
- Extension Methods
Remarks
This is not a concurrency conflict, and the distinction is operational rather than cosmetic. A concurrency conflict is transient and the correct response is to reload and retry: another writer moved the record, so the next attempt has a real chance of succeeding. A tenant-isolation violation is permanent. The record belongs to somebody else, reloading returns nothing, and every retry fails identically — so a caller that treats it as a conflict retries a cross-tenant write forever, burning the operation and any retry budget on an attempt that cannot succeed by construction.
It carries no version, no record state, and nothing else read from the other tenant's data. Reporting "the persisted version is 7" would disclose that a record exists at that identifier and how far it has advanced — facts this caller is not entitled to. The exception says only that the operation was refused.
It deliberately does not derive from the concurrency exception type. Sharing that type is exactly what makes the two indistinguishable to a correct caller, and a caller written against the transient contract would inherit the infinite retry rather than being forced to handle this case explicitly.
Constructors
TenantIsolationViolationException()
Initializes a new instance of the TenantIsolationViolationException class.
public TenantIsolationViolationException()
TenantIsolationViolationException(string)
Initializes a new instance of the TenantIsolationViolationException class with a message.
public TenantIsolationViolationException(string message)
Parameters
messagestringThe message that describes the error.
TenantIsolationViolationException(string, Exception)
Initializes a new instance of the TenantIsolationViolationException class with a message and the underlying cause.
public TenantIsolationViolationException(string message, Exception innerException)
Parameters
messagestringThe message that describes the error.
innerExceptionExceptionThe exception that is the cause of this exception.
TenantIsolationViolationException(string, string)
Initializes a new instance of the TenantIsolationViolationException class for a specific record, naming the resource and identifier without disclosing anything about the record's contents.
public TenantIsolationViolationException(string resourceType, string resourceId)
Parameters
resourceTypestringThe kind of record that was addressed, for example the saga state type name.
resourceIdstringThe identifier the caller supplied. This came from the caller, so echoing it discloses nothing.
Properties
ResourceId
Gets the identifier the caller supplied, or null when not specified.
public string? ResourceId { get; }
Property Value
ResourceType
Gets the kind of record that was addressed, or null when not specified.
public string? ResourceType { get; }