Table of Contents

Class NoTenantTermAttribute

Namespace
Excalibur.Data
Assembly
Excalibur.Data.Abstractions.dll

Declares that a relational data request binds no tenant term, and states the argument that makes that correct.

[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public sealed class NoTenantTermAttribute : Attribute
Inheritance
NoTenantTermAttribute
Inherited Members

Examples

[NoTenantTerm(
    TenantConfinement.IdentityAddressed,
    "The outbox Id is the table's primary key, so this statement already addresses at most one row.")]
public sealed class MarkMessageSentRequest : DataRequestBase<IDbConnection, int>

Remarks

This is documentation, not enforcement, and the distinction is the point. Nothing reads this attribute at run time and nothing derives behaviour from it; the tenant term is applied where the request builds its parameters, and that is the only thing that decides what the query does. What the attribute delivers is a searchable, per-kind index of the statements that deliberately carry no tenant term, so a reviewer can find them without re-reading every request's SQL.

There is deliberately no marker for the ordinary tenant-confined case. A request that binds a tenant term already says so, in the parameter binding, in the one place that determines the behaviour. A second declaration restating it could only ever agree with it or lie about it, and a declaration that can lie is worse than no declaration at all. The shape is the framework's own authorization convention: no attribute for the default, an explicit attribute only for the exception.

The justification is required and must be a non-empty compile-time constant. A statement may span every tenant, or decline a tenant term for one of the other reasons, but it may not do so silently — an unexplained omission is indistinguishable from an oversight, which is the confusion this attribute exists to remove.

Scope. This covers the relational surface routed through IDataRequest<TConnection, TModel>. Document and key-value stores compose the tenant into a document identifier and do not pass through this seam, so it does not speak for them.

Constructors

NoTenantTermAttribute(TenantConfinement, string)

Initializes a new instance of the NoTenantTermAttribute class.

public NoTenantTermAttribute(TenantConfinement confinement, string justification)

Parameters

confinement TenantConfinement

The argument that makes the absent tenant term correct.

justification string

Why this argument applies to this statement, stated in terms of the behaviour and the real key — for example "the outbox Id is the table's primary key, so a tenant term could only subtract".

Properties

Confinement

Gets the argument that makes the absent tenant term correct.

public TenantConfinement Confinement { get; }

Property Value

TenantConfinement

One of the TenantConfinement kinds.

Justification

Gets the stated reason this argument applies to this statement.

public string Justification { get; }

Property Value

string

The justification supplied at the declaration site.