What is the difference between domain objects, POCOs and entities?

前端 未结 5 1899
萌比男神i
萌比男神i 2021-01-29 17:42

I was under the impression they are all basically the same. Are model objects also the same?

Right now, in my architecture, I have:

class Person 
{

            


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-29 18:06

    There are already good explainations of Domain and Model in the answers above.

    In a Database-Context Entity means Item in a Entity Relationship Model ERD. (i.e. a Row in a Table)

    In the Microsoft-Dotnet-EntityFramework-World Entity means an Object that can be loaded from and saved to a database using a Data(Base)Context. Usually an Entity cannot exist without its Data(Base)Context. (Unit-) Testing the business functionality of these classes is difficuilt.

    Pocos (Plain Old CommonRuntime Objects) can exist without the PersistenceFramework (EntityFramework or NHibernate) thus they are much easier to test.

    The word poco is the adaptaion of pojo (plain old java object) that were created in the java world for the same reason.

提交回复
热议问题