Zum Hauptinhalt springen

GenericCreateReplacement

Namespace: Meshmakers.Octo.ConstructionKit.Contracts.DependencyGraph

The lookup "which method replaces the generic create of type X". A static method with replacesGenericCreate: true makes the method the only way to create an entity of the type that declares it and of every type derived from it; the methods of a type graph include the inherited ones, so the lookup is the same for the declaring type and for a derived concrete type. Shared by every writer that must refuse a generic create (asset repository, MCP, adapter pre-check, blueprint apply) so none keeps its own copy.

public static class GenericCreateReplacement

Inheritance Object → GenericCreateReplacement

Fields​

ReasonToken​

The stable, language-neutral reason token that callers put into a refusal (GraphQL code, blueprint apply message) when a generic create is refused because a method replaces it.

public static string ReasonToken;

Methods​

FindReplacingMethod(CkTypeGraph)​

The method that replaces the generic create of the type, or null when the generic create is allowed. When a (malformed) graph holds more than one flagged method, the one with the smallest qualified id is returned, so the answer is deterministic.

public static CkMethodGraph FindReplacingMethod(CkTypeGraph typeGraph)

Parameters​

typeGraph CkTypeGraph
The type graph (own and inherited methods)

Returns​

CkMethodGraph

TryGetReplacingMethod(ICkCacheService, String, RtCkId<CkTypeId>, out CkMethodGraph)​

Looks up the type by its version-less runtime id in the tenant's CK cache and returns the method that replaces its generic create. A type that is not in the cache yields false (the create fails on its own).

public static bool TryGetReplacingMethod(ICkCacheService ckCacheService, string tenantId, RtCkId<CkTypeId> rtCkTypeId, out CkMethodGraph method)

Parameters​

ckCacheService ICkCacheService
The CK cache

tenantId String
The tenant

rtCkTypeId RtCkId<CkTypeId>
The type to be created

method CkMethodGraph
The replacing method, when the result is true

Returns​

Boolean
True when a method replaces the generic create of the type