Attempting to validate the approach for data flow in an MVC application that i am cleaning up and streamlining, (after a bit of refactoring) things currently looks like the diagram below (Data flow indicated by arrows). and some parts are written to access the the repository services jumping over layers. (Like an HTML helper directly accessing a repository service for lookup data)
Few Questions.
- Is this a typical design and are there any pitfalls?
- Is skipping layers for trivial things acceptable?
- The flow of data is it architecturally sound?
Seems already quite good.
Typically I have following layering:
To minimize dependencies, I program against interfaces; of which the concrete implementation is injected by an IoC container. This means that every component is also very testable.
Your controllers of the presentation layer are thin, and use the services layer only (and infrastructure layer).
This is a very flexible approach, yet simple enough to work for most types of applications. Also, if you use entity framework, you might want to think about whether you actually need repositories and unit of work.