Design question on entity framework and Domain Layer -
I am creating a new application using the Entity Framework and the DTOs and Entity Objects would have the same structure but there would be quite a bit of business logic involved. So am wondering which would be the best approach from the following, considering the performance and maintainability of the application
Approach 1:
- Use Entity Objects generated from the T4 template as domain objects
- create partial classes and add the business logic
- List item
Expose the Entity Objects to the UI Layer
Approach 2:
- Create DTOs for the domain layer
- Add business logic to the DTOs
- Implement mapping between the Entity -> DTO and DTO -> Entity
- Expose the DTOs to the UI layer