> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# csharp-ef-count-materialized

> An EF Core DbSet is materialized solely to count its rows.

## What it flags

A C# EF Core query materializes rows into a list or array immediately before reading its count. The rule looks for a `DbSet<T>` declaration from Entity Framework Core.

## How to review or fix

Use `Count()` or `CountAsync()` directly on the query so the database can return a count without transferring the rows.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.