DbSet<T>
DbSet<T> is an Entity Framework Core type representing a queryable and persistable set of entities of type T within a database context.
Building Web APIs with ASP.NET Core
DbSet<T> is an Entity Framework Core type representing a set of entities of a specified type and providing query and database operations for that set.
- How it is used
- Exposes entity sets through a DbContext for a board-game API's data operations.
- How deep it goes
- Defines the set and walks through properties, queries, additions, change tracking, and deferred query execution.
- Examples
- Uses a CSV board-game import, a filtered and ordered game query, and a category junction-entity exercise.
- What you can do after
- Apply it via Entity Framework Core to expose entity sets, compose queries, and add entities before saving changes.
Read how Building Web APIs with ASP.NET Core explains DbSet<T> →
ASP.NET Core in Action, 3e
DbSet<T> is the Entity Framework Core API representing a set of entities of type T and exposing query and persistence operations.
- How it is used
- Uses DbSet properties as entry points for entity discovery, database queries, and entity lookup in a DbContext.
- How deep it goes
- Explains model discovery, LINQ query execution, FindAsync tracking behavior, and snapshot-based updates, while deferring mapping customization to documentation.
- Examples
- Shows a recipe context, a filtered projection to view models, and a soft-delete update.
- What you can do after
- Apply it via Entity Framework Core to query entities, find an entity by ID, and save changes through a DbContext.
.NET in Action, Second Edition
DbSet is an Entity Framework Core API type representing a queryable and persistable collection of entities in a database context.
- How it is used
- Represents entity collections that applications query and persist through a DbContext.
- How deep it goes
- Explains declaration, querying, saving, generated identifiers, and version-specific initialization warnings.
- Examples
- Uses a Book entity, an in-memory database, inserted catalog books, SaveChanges, and an ordered Books query.
- What you can do after
- Operate a DbSet<T> by declaring it on a DbContext, adding entities, saving changes, and querying results.
Also covered in
What to know first
- foreign keyA foreign key is a column or set of columns in a relational table whose values reference a key in the same or another table, linking records and supporting referential integrity.
- database tableA database table is a relational data structure that organizes records into rows whose values correspond to defined columns.
Related concepts
- IQueryablekind of · IQueryable is a .NET interface for representing queryable data sources whose query expressions can be composed and interpreted or executed by a query provider.
- Entity Framework Coreused by · Entity Framework Core is a cross-platform object-relational mapper for .NET that enables applications to query and persist data through .NET objects and APIs.
- database tableequivalent to · A database table is a relational data structure that organizes records into rows whose values correspond to defined columns.
- dbcontextpart of · DbContext is the Entity Framework Core class that coordinates database access, entity querying and change tracking, and persistence for an application’s data model.
Questions about DbSet<T>
What is DbSet<T>?
DbSet<T> is an Entity Framework Core type representing a queryable and persistable set of entities of type T within a database context.
Which Manning books explain DbSet<T>?
Building Web APIs with ASP.NET Core, ASP.NET Core in Action, 3e and .NET in Action, Second Edition.
What should I know before learning DbSet<T>?
Manning books that teach DbSet<T> usually introduce foreign key and database table first.
What is DbSet<T> a kind of?
DbSet<T> is a kind of IQueryable. IQueryable is a .NET interface for representing queryable data sources whose query expressions can be composed and interpreted or executed by a query provider.
What is DbSet<T> part of?
DbSet<T> is part of dbcontext. DbContext is the Entity Framework Core class that coordinates database access, entity querying and change tracking, and persistence for an application’s data model.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


