Zum Hauptinhalt springen

AttributeOwnership

Namespace: Meshmakers.Octo.ConstructionKit.Contracts.DataTransferObjects

Resolution and behaviour predicates for AttributeOwnershipDto. Every consumer goes through these instead of testing the enum inline, so the two behaviours the ownership model separates stay separated in exactly one place each.

public static class AttributeOwnership

Inheritance Object → AttributeOwnership

Methods​

Resolve(Nullable<AttributeOwnershipDto>, Boolean)​

The value an attribute declaration resolves to. ownership wins when declared; otherwise the deprecated isRuntimeState alias is mapped (true → AttributeOwnershipDto.RuntimeState, false / absent → AttributeOwnershipDto.SeedOwned). Every declaration that exists today therefore resolves with zero behaviour change.

public static AttributeOwnershipDto Resolve(Nullable<AttributeOwnershipDto> ownership, bool isRuntimeState)

Parameters​

ownership Nullable<AttributeOwnershipDto>

isRuntimeState Boolean

Returns​

AttributeOwnershipDto

Resolve(Nullable<AttributeOwnershipDto>, AttributeOwnershipDto)​

Effective ownership of an attribute assignment: the assignment's override wins, the attribute definition's value is the default. null on the assignment means "inherit", which is what every assignment that exists today declares.

public static AttributeOwnershipDto Resolve(Nullable<AttributeOwnershipDto> assignmentOwnership, AttributeOwnershipDto definitionOwnership)

Parameters​

assignmentOwnership Nullable<AttributeOwnershipDto>

definitionOwnership AttributeOwnershipDto

Returns​

AttributeOwnershipDto

IsPreservedOnUpsert(AttributeOwnershipDto)​

True when an Upsert import must keep the tenant's existing value instead of the incoming seed value — i.e. everything except AttributeOwnershipDto.SeedOwned. This is the predicate ImportRtModelCommand.PreserveRuntimeStateAttributesAsync filters on, and it is what the deprecated isRuntimeState boolean now mirrors.

public static bool IsPreservedOnUpsert(AttributeOwnershipDto ownership)

Parameters​

ownership AttributeOwnershipDto

Returns​

Boolean

ResolveForValueType(AttributeValueTypesDto, AttributeOwnershipDto)​

Applies the value-type rule on top of a resolved ownership (AB#5528): a AttributeValueTypesDto.Secret attribute is always AttributeOwnershipDto.Secret, whatever was declared or defaulted. Every other value type keeps resolvedOwnership.

public static AttributeOwnershipDto ResolveForValueType(AttributeValueTypesDto valueType, AttributeOwnershipDto resolvedOwnership)

Parameters​

valueType AttributeValueTypesDto
The attribute's value type

resolvedOwnership AttributeOwnershipDto
The ownership resolved from the declaration

Returns​

AttributeOwnershipDto
The effective ownership

IsExcludedFromExport(AttributeOwnershipDto)​

True when the value must not be carried in an exported runtime model (ExportRt) — AttributeOwnershipDto.RuntimeState because a re-import would overwrite live state with stale values (Bug #1458), and AttributeOwnershipDto.Secret because a credential is not part of a portable model. AttributeOwnershipDto.TenantOwned IS exported: that is the capability the boolean could not express.

public static bool IsExcludedFromExport(AttributeOwnershipDto ownership)

Parameters​

ownership AttributeOwnershipDto

Returns​

Boolean