---
title: 'ARC0001: Incorrect query method signature on ReadModel'
---

## Rule

Query methods on types with `[ReadModel]` must return the ReadModel type, a collection, `Task`, `IAsyncEnumerable`, or `ISubject` of the ReadModel type.

## Severity

Error

## Valid Return Types

Query methods must return one of the following:

```csharp
ReadModel
IEnumerable<ReadModel>
List<ReadModel>
ReadModel[]
Task<ReadModel>
Task<IEnumerable<ReadModel>>
IAsyncEnumerable<ReadModel>
ISubject<ReadModel>
ISubject<IEnumerable<ReadModel>>
```

## Example

### Violation

```csharp
[ReadModel]
public class User
{
    public Guid Id { get; set; }
    public string Name { get; set; }

    // ARC0001: Invalid return type
    public static string GetName(Guid id)
    {
        return "name";
    }
}
```

### Fix

```csharp
[ReadModel]
public class User
{
    public Guid Id { get; set; }
    public string Name { get; set; }

    public static User GetById(Guid id) => new();

    public static IEnumerable<User> GetAll() => [];

    public static Task<User> GetByIdAsync(Guid id) => Task.FromResult(new User());
}
```

## Why This Rule Exists

ReadModel query methods form the public query surface of a ReadModel. Standardized return types ensure:
- The runtime can recognize and execute queries consistently.
- Query results are predictable and can be composed with async patterns.
- Streaming and reactive query patterns are supported where appropriate.

## Related Rules

- [ARC0002](/arc/backend/code-analysis/arc0002/): Missing [Command] attribute on command-like type
