ARC0001: Incorrect query method signature on ReadModel
Reports public static non-void methods on [ReadModel] types whose return type is not the read model or an accepted wrapper. Default severity: Error. Move unrelated utility methods off the read model rather than exposing them as queries.
Accepted return shapes
Section titled “Accepted return shapes”For read model T, the analyzer accepts:
TandT[]IEnumerable<T>and types implementing it, includingList<T>andIQueryable<T>Task<T>andTask<C>whereCis an accepted collection ofTIAsyncEnumerable<T>ISubject<T>andISubject<C>whereCis an accepted collection ofT
These are type shapes, not declarations to paste into a file. A nongeneric Task and ValueTask<T> are not accepted by this analyzer. For transport behavior, see query return types.
Diagnostic example
Section titled “Diagnostic example”Compile each block separately with Cratis.Arc.Core. The first intentionally produces ARC0001; it is not a runnable application.
using System;using Cratis.Arc.Queries.ModelBound;
[ReadModel]public record User(Guid Id, string Name){ public static string GetName(Guid id) => "Ada";}Return the read model instead:
using System;using Cratis.Arc.Queries.ModelBound;
[ReadModel]public record User(Guid Id, string Name){ public static User GetById(Guid id) => new(id, "Ada");}This fixed declaration returns sample data; it does not demonstrate database persistence or host setup. Both declarations use records so ARC0008 does not distract from the return-type error.