在这个 article 中说:
The Entity Framework enables you to use custom data classes together with your data model without making any modifications to the data classes themselves. This means that you can use "plain-old" CLR objects (POCO), such as existing domain objects, with your data model. These POCO data classes (also known as persistence-ignorant objects), which are mapped to entities that are defined in a data model, support most of the same query, insert, update, and delete behaviors as entity types that are generated by the Entity Data Model tools.
POCO 是一个具有行为的 DTO。
所以 POCO 与实体不同?有什么区别?
最佳答案
Plain Old CLR Object ( POCO ) 与 Plain Old Java Object (POJO) 具有相同的含义.
The term was coined while Rebecca Parsons, Josh MacKenzie and I were preparing for a talk at a conference in September 2000. In the talk we were pointing out the many benefits of encoding business logic into regular java objects rather than using Entity Beans. We wondered why people were so against using regular objects in their systems and concluded that it was because simple objects lacked a fancy name. So we gave them one, and it's caught on very nicely.
by Martin Fowler
POCO 只是一个常规对象,没有对任何特定框架的引用,也不遵循它们的接口(interface)或限制。POCO 类是持久性无知对象,可以与任何 ORM 一起使用。
Entity是一个具有身份并且可以唯一确定的对象。
实体代表领域模型和领域逻辑。通常它们被设计为持久性无知的 POCO 对象。但并非每个 POCO 对象都是实体。 Value Objects也被设计为 POCO 对象和 they are not Entities.
关于c# - 实体和 POCO 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22845989/