Reputation: 1707
I'm starting a new project, so it's time to re-evaluate how I do things.
In the recent past I have created a 3 layer/tier project (UI, Domain, Data) with each tier with it's own separate model. The the DAL has it's data entities consumed by the Domain layer, which mapped them to domain models which were consumed by the UI which mapped them to ViewModels.
This did allow for some differentiation at each level (especially UI) but the mapping was overwhelmingly tedious (Automapper helped a little) and the Domain and Data layers were basically 1:1, with the UI view models being the most useful.
I'm trying to figure out how to simplify for my next project and I could use some suggestions.
Edit: As it is, I'm considering having a set of dto's shared between the Domain layer and Data layer. It locks me into the datbase structure more, but saves a lot of mapping between identical types.
Upvotes: 1
Views: 85
Reputation: 15377
I think you might wnat to take a look at MVVM, especially since it is for UI/model separation which you already think it is useful. It focusses less on data (at least not to split up data).
Also many people split Data (called Model in MVVM) and the serialization of data.
As far as I can see, Domain and Data is so closely coupled you shouldn't split it (I never do). But maybe your definition of Domain and Data is a bit different.
Upvotes: 1