oopentitydata-access-layerdata-transfer-objects

Is a DTO with an ID property considered an Entity?


I am trying to clarify my understanding of a DTO and an Entity object. It seems like an Entity can hold it's identity even if its attributes change as long as it has an id.

Isn't it possible for Data Transfer Object also to have the same definition?


Solution

  • What you mean by Entity here? You mean POCO? If yes then NO DTO and POCO both are not same. A POCO can maintain state and have it's behavior but DTO's are just for transferring the state and have no behavior doesn't maintain any behavior. See Martin Fowler Blog on DTO