# LS2001: Implementation Type Is Not Internal Sealed

## Intent

LS2001 is a compiler check that reports a handler, validator, endpoint, or other implementation type in the Application, Infrastructure, and WebApi projects that is not internal and sealed, which would invite callers to depend on it directly instead of going through its interface. This page states what the rule reports, where the warning sits, and how to close the type.

## Reference

### What the rule enforces

LS2001 enforces [Keep implementation types internal](https://litespec.dev/2.0.0/backend/dotnet/architecture.md#keep-implementation-types-internal) (`litespec/backend/dotnet/architecture#keep-implementation-types-internal`). It runs in Application, Infrastructure, and WebApi. Its category is `LiteSpec.Layers`. It reports a warning and is enabled by default, as the [Analyzers overview](https://litespec.dev/2.0.0/analyzers/README.md) describes.

### What the rule reports

The rule reports a class whose name ends in `Handler`, `PreHandler`, `PostHandler`, `Validator`, `Endpoint`, `Definition`, `Repository`, `Configuration`, or `Projection`, or that implements `IEndpoint`, `ICommandHandler`, `IQueryHandler`, `IEventHandler`, or `IValidator`, unless the class is both sealed and non-public. The diagnostic sits on the type name.

### Failing example

```csharp
namespace Shop.Application.Orders.PlaceOrder;

public sealed class PlaceOrderCommandHandler { }
```

### Passing example

```csharp
namespace Shop.Application.Orders.PlaceOrder;

internal sealed class PlaceOrderCommandHandler { }
```

### How to fix

Declare the implementation type `internal sealed`.

## Notes

### What the rule ignores

The rule does not report abstract classes or classes without an implementation name such as `OrderService`. It does not run in Domain or Application.Abstractions.
