Class ShardInfo
Describes a data shard's connection and routing metadata.
public sealed record ShardInfo : IEquatable<ShardInfo>
- Inheritance
-
ShardInfo
- Implements
- Inherited Members
Constructors
ShardInfo(string, string, string?, string?, string?, string?)
Describes a data shard's connection and routing metadata.
public ShardInfo(string ShardId, string ConnectionString, string? SchemaName = null, string? DatabaseName = null, string? IndexPrefix = null, string? Region = null)
Parameters
ShardIdstringThe unique shard identifier.
ConnectionStringstringThe connection string for this shard's primary data store.
SchemaNamestringOptional schema name for schema-per-tenant isolation (SQL Server/Postgres).
DatabaseNamestringOptional database name for database-per-tenant isolation.
IndexPrefixstringOptional index prefix for document/search store isolation (Elasticsearch, CosmosDB).
RegionstringOptional region hint for geo-distributed shards.
Properties
ConnectionString
The connection string for this shard's primary data store.
public string ConnectionString { get; init; }
Property Value
DatabaseName
Optional database name for database-per-tenant isolation.
public string? DatabaseName { get; init; }
Property Value
IndexPrefix
Optional index prefix for document/search store isolation (Elasticsearch, CosmosDB).
public string? IndexPrefix { get; init; }
Property Value
Region
Optional region hint for geo-distributed shards.
public string? Region { get; init; }
Property Value
SchemaName
Optional schema name for schema-per-tenant isolation (SQL Server/Postgres).
public string? SchemaName { get; init; }
Property Value
ShardId
The unique shard identifier.
public string ShardId { get; init; }
Property Value
Methods
RequireCoordinate(string?, string)
Returns an isolation coordinate this shard declares, or throws when it does not declare one.
public string RequireCoordinate(string? value, string coordinateName)
Parameters
valuestringThe coordinate read from this shard entry.
coordinateNamestringThe coordinate's name, for the message.
Returns
- string
The declared value.
Remarks
A shard exists to keep one tenant's data apart from another's, so a coordinate it does not declare cannot be filled from a shared default: two shards that both omit the same coordinate resolve to the same physical location, and the tenants mapped to them are silently commingled with no error and no log. Where the intended value genuinely is the deployment default, the shard entry states it — an isolation boundary is not something to infer from a null.
Exceptions
- InvalidOperationException
Thrown when the shard declares no value.