When creating an n-tier solution, I don’t want to disclose my business objects, but use DTO instead. On the other hand, I don't want to define objects twice and write code copies all the time.
Now, my idea would be to write a DTO containing all the necessary fields and properties, but not logic (only state).
Then I would extract my business objects from these DTOs, expanding them with my business logic, working on the properties of the DTO base classes. These objects will also be objects stored in the used ORM (NHibernate).
With this server-side approach, I could work with business objects and transfer them directly to the client (they are produced, so they are reset). I would not expose my business logic this way and save a lot of code.
Do you think the approach is reasonable?
Hello,
Sebastian
source
share