# LS2009: Result Part Not Named After Its Result

## Intent

LS2009 is a compiler check that reports a result part, a type declared beside a use-case result and reached through its properties, whose name does not start with the result name, so a reader cannot tell which result the part belongs to. This page states what the rule reports, where the error sits, and how to name the part after its result.

## Reference

### What the Rule Enforces

LS2009 enforces [Name result parts after their result](https://litespec.dev/4.0.0/workspace/naming.md#name-result-parts-after-their-result) (`litespec/workspace/naming#name-result-parts-after-their-result`). It runs in Application, Infrastructure, and Worker. Its category is `LiteSpec.Layers`. Severity and enablement follow the [Analyzers overview](https://litespec.dev/4.0.0/analyzers/README.md).

### What the Rule Reports

The rule reports a type declared in the same namespace as a `{UseCase}QueryResult` or `{UseCase}CommandResult` type, when the result reaches it through a public property, directly or through another part, including as a collection element, and its name does not start with the result name. A helper the handler uses and the result does not reach, such as a page reader or a cursor, is not a part, and the rule ignores it. The diagnostic sits on the type name, and its message names the part and the result it belongs to.

### Failing Example

```csharp
public sealed record ReadLoanQueryResult(int LoanId, LoanHoldItem[] Holds);

public sealed record LoanHoldItem(int HoldId);
```

### Passing Example

```csharp
public sealed record ReadLoanQueryResult(int LoanId, ReadLoanQueryResultHold[] Holds);

public sealed record ReadLoanQueryResultHold(int HoldId);
```

### How to Fix

Name the part `{UseCase}QueryResult{Part}` or `{UseCase}CommandResult{Part}`, starting with the full result name.

## Notes

### What the Rule Ignores

The rule does not report the result itself, a type the result does not reach (the message, handler, validator, definition, or a helper), a nested type, or a type declared where no result is declared. It does not run in Domain or WebApi.
