I have a 3-layered ASP.NET MVC application. The BLL references another project where I have web service proxy classes for payment gateway. Right now I'm using development web service but later will switch to production one.
I am trying to expose the web service to BLL via a class implementing interface (so I can easily swap from dev to production service) however I'm not sure how to use the interface properly in this scenario. I figured there are two options.
Please advise on which method is better.
I would suggest the adapter design pattern . You would use a class wrapping the service functionality (adaptor class). Then you would use the adaptor class for the rest of the project, as if it was the actual service. When you are ready to switch to the new service, the change would be made only on the adaptor class.
Hope I helped!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.