What is POCO in Entity Framework? [closed]

扶醉桌前 提交于 2019-11-26 19:07:14

问题


I just started learning POCO but cannot understand its use and advantage. Even 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?


回答1:


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



来源:https://stackoverflow.com/questions/16075245/what-is-poco-in-entity-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!