Home  /  Questions  /  Question

50   50
Oct 18, 2011

Design pattern for Controller in ASP.NET MVC3

I have WCF Services exposed by dynamics CRM 2011,  and a ASP.NET MVC3 portal to consume these services.

I have to make call to WCF services from controller and I don't want to make call to WCF services directly from controller. I can think of following patterns

  • Service Facade
  • Command Factory
  • DI and IoC at controller level

What is the best practice in terms of patterns for this scenario.


1,364   100.0
Dec 02, 2011
DI and IOC will complement the wcf services (whether you use Service Facade or not). But even DI/IOC is not always required. Evaluate your scenarios and choose the best fit approach

But since you mentioned your WCF services just provide an abstraction layer for your CRM 2011, having the layer of indirection of DI/IOC is a good idea and will make your design a bit flexible.