I have a 3 layered application.

  • Presentation Layer (PL): ASP.NET MVC app
  • Business Logic Layer (BLL) project
  • Data Access Layer (DAL) project

I need to add a Web Reference to a service for a payment gateway. Where does it go? PL or BLL?

P.S. Before using the Web service I need to retrieve some data from database and send that data to web service.

1 Answer 1


Since the actual operation isn't something the user needs to see then Presentation is out. What we have left is the Data Access and the Business layers. Since you aren't actually manipulating data from the payment gateway it's more of an external business process, which makes the Business layer the logical home for it.

  • 1
    Don't actually reference it from your BLL though. That will introduce a concete dependency, and you don't want that because you might want to stub it for testing, or the vendor might introduce a new version of the API, and then you'll need to have both versions in your code for a time. I normally give proxies to external services their own project, and code to them by interface.
    – Mr Cochese
    Dec 19, 2013 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.