What is POCO in Entity Framework?

133,330

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

Share:
133,330
Admin
Author by

Admin

Updated on July 08, 2022

Comments

  • Admin
    Admin almost 2 years

    I just started learning POCO but I cannot understand the usage and advantage. Even the following link of StackOverflow did not help me.

    what is Entity Framework with POCO

    Can anybody explain the usage of POCO with a simple example?

  • Aske B.
    Aske B. over 7 years
    Your "POCO Entity framework MSDN Part-I" link is broken. Is it this now? msdn.microsoft.com/en-us/library/dd456853(v=vs.100).aspx
  • Prabhu Murthy
    Prabhu Murthy over 7 years
    @AskeB. thanks updated the link. thats the one
  • Halter
    Halter about 7 years
    I've always refereed to POCOs as "plain old C objects" is this wrong or just different?
  • Nate Barbettini
    Nate Barbettini about 7 years
    @Halter "Plain ol' C# objects", or (as Prabhu) said "CLR objects" since the same concept applies to VB and F#.