I am currently investigating multi tier architecture design for a web based application in MVC3. I already have an architecture but not sure if its the best I can do in terms of extendability and performance.
The current architecure has following components
- DataTier (Contains EF POCO objects)
- DomainModel (Contains Domain related objects)
- Global (Among other common things it contains Repository objects for CRUD to DB)
- Business Layer (Business Logic and Interaction between Data and Client and CRUD using repository)
- Web(Client) (which talks to DomainModel and Business but also have its own ViewModels for Create and Edit Views for e.g.)
Note: I am using ValueInjector for convering one type of entity to another. (which is proving an overhead in this desing. I really dont like over doing this.)
My question is am I having too many tiers in the above architecure? Do I really need domain model? (I think I do when I exposes my Business Logic via WCF to external clients).
What is happening is that for a simple database insert it
(1) create ViewModel
(2) Convert ViewModel to DomainModel for Business to understand
(3) Business Convert it to DataModel for Repository and then data comes back in the same order.
Few things to consider,
I am not looking for a perfect architecure solution as it does not exits. I am looking for something that is scalable. It should resuable (for e.g. using design patterns ,interfaces, inheritance etc.) Each Layers should be easily testable.
Any suggestions or comments is much appriciated.