Skip to content

ARC0027: Generated value implements both generation contracts

A [GeneratedValue] parameter implements both IGeneratable<TSelf> and IGeneratableInContext<TSelf> for its own type. Default severity: Warning. Arc always selects New(GenerationContext); it never calls the plain New() for that parameter. The diagnostic is on the parameter, including when the concept comes from a referenced assembly.

This concept declaration intentionally implements both contracts. Use it with a command’s [GeneratedValue] Handle parameter to produce ARC0027:

using Cratis.Concepts;
public record OrderId(string Value) : ConceptAs<string>(Value), IGeneratable<OrderId>, IGeneratableInContext<OrderId>
{
public static OrderId New() => new(GenerateValue.TypeId("order"));
public static OrderId New(GenerationContext context) => new(GenerateValue.TypeId("order", context));
}

Remove IGeneratable<OrderId> and the plain factory when they have no other callers. Keep IGeneratableInContext<OrderId> and its context factory. If callers outside Arc still need both forms, suppress the warning narrowly with that justification.

See generation context for received-time and tenant mapping. This diagnostic has no automatic code fix.