I am using MVC 3. I am trying to get my head around the services layer and the service. I am currently working through the sample app that comes with the DoFactory source code. This question is based on the sample application, but in general.
There is a service layer (WCF) that exposes a set of service methods. The service layer implements a single point of entry (the Façade pattern) through which all communication with the layers below must occur. The Façade is the entry point into the business layer and exposes a very simple, course-grained API.
Lets says I am trying to get a list of clients, then in the MVC controller it will call the repository’s GetCustomers method, then this will call the service layers GetCustomers method.
I think I am a bit confused here. Is this application architecture correct? Shouldn’t the controller call the service layer’s method and then this call repository’s method. I always thought that the repository was always the last method called to get data?
Please can someone help clarify this?
Your architecture is correct.
Yes, in your case the data comes from a WCF service but it could be anything: SQL database, XML file, …