Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is POCO in Entity Framework? [closed]

People also ask

What is a POCO in C#?

In software engineering, a plain old CLR object, or plain old class object (POCO) is a simple object created in the . NET Common Language Runtime (CLR) that is unencumbered by inheritance or attributes.

What is POCO database?

POCO Data is POCO's database abstraction layer which allows users to easily send/retrieve data to/from various databases. Currently supported database connectors are SQLite, MySQL/MariaDB, PostgreSQL and ODBC (which covers SQL Server and other databases).

What is the difference between POCO code first and simple EF approach?

If you use EF code first you have POCO objects and the database is created with code from the DbContext class. You get no visual designer when using code first. You can also use POCOs for “ordinary” EF but then your database will be handled by an edmx file and a visual designer.


POCOs(Plain old CLR objects) are simply entities of your Domain. Normally when we use entity framework the entities are generated automatically for you. This is great but unfortunately these entities are interspersed with database access functionality which is clearly against the SOC (Separation of concern). POCOs are simple entities without any data access functionality but still gives the capabilities all EntityObject functionalities like

  • Lazy loading
  • Change tracking

Here is a good start for this

POCO Entity framework

You can also generate POCOs so easily from your existing Entity framework project using Code generators.

EF 5.X DbContext code generator