What is POCO in Entity Framework?
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
You can also generate POCOs so easily from your existing Entity framework project using Code generators.
EF 5.X DbContext code generator
Admin
Updated on July 08, 2022Comments
-
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. over 7 yearsYour "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 over 7 years@AskeB. thanks updated the link. thats the one
-
Halter about 7 yearsI've always refereed to POCOs as "plain old C objects" is this wrong or just different?
-
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#.