What are some questions I can ask myself about our design to identify if we should use DTOs or Self-Tracking Entities in our application?
Here's some things I know of to take into consideration:
- We have a standard n-tier application with a WPF/MVVM client, WCF server, and MS SQL Database.
- Users can define their own interface, so the data needed from the WCF service changes based on what interface the user has defined for themselves
- Models are used on both the client-side and server-side for validation. We would not be binding directly to the DTO or STE
- Some Models contain properties that get lazy-loaded from the WCF service if needed
- The Database layer spams multiple servers/databases
- There are permission checks on the server-side which affect how the data is returned. For example, some data is either partially or fully masked based on the user's role
- Our resources are limited (time, manpower, etc)
So, how can I determine what is right for us? I have never used EF before so I really don't know if STEs are right for us or not.
I've seen people suggest starting with STEs and only implement DTOs if they it becomes a problem, however we currently have DTOs in place and are trying to decide if using STEs would make life easier. We're early enough in the process that switching would not take too long, but I don't want to switch to STEs only to find out it doesn't work for us and have to switch everything back.