What's the difference between entity and class?

前端 未结 7 1107
孤独总比滥情好
孤独总比滥情好 2020-12-23 11:01

Is entity an instance of class?

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 11:50

    A class is a template for an object (among other things), and is a very general concept.

    An entity has more semantic significance and is usually tied to a concept (possibly about a real object for example, an Employee or a Student or a Music Album) and is linked to business logic.

    Entities are usually used to establish a mapping between an object and to a table in the database. Entities are also known as domain objects. Like I mentioned before, entities will be used in situations where there is business logic and as such it hold information about the system (or part of the system) that it is modeling.

提交回复
热议问题