---
title: 'ARC0027: Generated value implements both generation contracts'
editUrl: https://github.com/Cratis/Arc/edit/main/Documentation/backend/csharp/code-analysis/ARC0027.md
description: Remove an unused plain generation contract when Arc always selects context-dependent generation.
---


## Rule

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.

## Diagnostic example

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

```csharp
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));
}
```

## Fix

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](/arc/backend/csharp/commands/generated-values/#generate-with-the-commands-time-and-tenant)
for received-time and tenant mapping. This diagnostic has no automatic code fix.
