Entity Framework
POCO
.NET
C#
Software Development

What is POCO in Entity Framework?

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

In Entity Framework, POCO stands for Plain Old CLR Object. A POCO entity is just a normal C# class that represents your domain data without having to inherit from an Entity Framework base class or embed framework-specific behavior directly into the type. That separation is important because it keeps the domain model easier to test, easier to reuse, and less tightly coupled to the ORM.

What a POCO Looks Like

A typical POCO entity is just a regular class with properties:

csharp
1using System;
2
3public class Book
4{
5    public int Id { get; set; }
6    public string Title { get; set; } = string.Empty;
7    public DateTime PublishedAt { get; set; }
8}

There is nothing Entity Framework-specific here. EF maps the class through conventions, attributes, or Fluent API configuration.

Why POCOs Are Preferred

POCO entities are attractive because they keep persistence concerns out of the class definition.

Benefits include:

  • cleaner domain model
  • easier unit testing
  • less dependency on ORM internals
  • easier migration to another persistence approach later

If your entity had to inherit from an EF base class just to exist, the model would become much harder to reuse outside the data layer.

Being a POCO does not mean the class cannot describe relationships. You can still use navigation properties naturally.

csharp
1using System.Collections.Generic;
2
3public class Author
4{
5    public int Id { get; set; }
6    public string Name { get; set; } = string.Empty;
7    public ICollection<Book> Books { get; set; } = new List<Book>();
8}

Entity Framework can map those relationships without requiring the class itself to be framework-heavy.

POCO Does Not Mean "No Mapping"

One common misunderstanding is that POCO means the object has nothing to do with persistence. That is not the point. A POCO can absolutely be mapped to a database table. The point is that the object remains a plain CLR class even while EF tracks and persists it.

In other words:

  • POCO means plain class design
  • EF mapping is still applied externally

Those two ideas work together well.

Lazy Loading and Proxies

People sometimes ask whether POCOs prevent advanced EF features such as lazy loading. Not necessarily. Entity Framework can still use proxies or other runtime behavior if configured, but the original class itself remains plain.

That distinction matters:

  • the class definition stays simple
  • EF may add runtime behavior around it when needed

So POCO is about the class structure, not about banning EF features completely.

POCO in EF Core Versus Older EF

The POCO idea exists across Entity Framework generations. In EF Core, plain C# classes are still the normal model style. What changes between versions is how features such as proxies, conventions, and configuration are wired, not the basic POCO concept itself.

That is why learning the idea is more useful than memorizing one version-specific detail.

When POCOs Are Not Enough by Themselves

A POCO model does not automatically make your design good. You still need:

  • sensible aggregates
  • validation rules
  • mapping configuration
  • clear boundaries between domain and persistence logic

POCO is helpful, but it is only one part of a maintainable data model.

Common Pitfalls

  • Thinking POCO means the class cannot be persisted by Entity Framework.
  • Mixing domain logic and persistence assumptions even though the class is technically plain.
  • Assuming POCO prevents lazy loading or navigation properties.
  • Treating POCO as a special EF type instead of just a normal CLR object.
  • Overestimating POCO as a complete architecture strategy rather than one good modeling practice.

Summary

  • POCO means Plain Old CLR Object.
  • In Entity Framework, it refers to normal C# classes used as entities.
  • POCOs reduce coupling between the domain model and the ORM.
  • Relationships and EF mapping still work with POCO entities.
  • The main benefit is a cleaner, more reusable model design.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.