Class AssetId
- Namespace
- Tudormobile.IronLedgerLib
- Assembly
- Tudormobile.IronLedgerLib.dll
Represents an asset identifier that can use different identification types.
public record AssetId : IEquatable<AssetId>
- Inheritance
-
AssetId
- Implements
- Inherited Members
- Extension Methods
Constructors
AssetId()
public AssetId()
AssetId(AssetId)
Copy constructor invoked by with expressions.
Intentionally excludes _idCache so that modified copies always
compute a fresh identifier from their own metadata.
protected AssetId(AssetId original)
Parameters
originalAssetIdThe original instance to copy properties from.
Properties
BaseBoardMetadata
Gets the baseboard (motherboard) level metadata associated with this asset.
public required AssetMetadata BaseBoardMetadata { get; init; }
Property Value
BiosMetadata
Gets the bios level metadata associated with this asset.
public required AssetMetadata BiosMetadata { get; init; }
Property Value
EqualityContract
protected virtual Type EqualityContract { get; }
Property Value
Id
Gets a unique identifier derived from the combined metadata. This ID is deterministic and suitable for use as a database key.
public string Id { get; }
Property Value
Remarks
The ID is generated using SHA256 hash of all metadata properties, ensuring consistency across multiple instantiations with the same data. The hash is computed lazily on first access and cached for subsequent calls. The cache is intentionally excluded from with expression copies so that modified instances always compute a fresh ID from their own metadata.
SystemMetadata
Gets the system level metadata associated with this asset.
public required AssetMetadata SystemMetadata { get; init; }
Property Value
Methods
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
Equals(AssetId?)
public virtual bool Equals(AssetId? other)
Parameters
otherAssetId
Returns
GetHashCode()
public override int GetHashCode()
Returns
IsValid(string?)
Determines whether the specified string is a valid asset identifier. A valid identifier is a 64-character lowercase hexadecimal string produced by a SHA-256 hash.
public static bool IsValid(string? id)
Parameters
idstringThe string to validate.
Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
ToString()
Returns the unique identifier for this asset.
public override string ToString()
Returns
- string
A 64-character hexadecimal string representing the unique identifier.
Operators
operator ==(AssetId?, AssetId?)
public static bool operator ==(AssetId? left, AssetId? right)
Parameters
Returns
operator !=(AssetId?, AssetId?)
public static bool operator !=(AssetId? left, AssetId? right)