views:

131

answers:

2

We here at my company are just about to get going on ASP.Net MVC 2 for our UI to interface a backend totally SOA with WCF/WSDL. I have looked at various books examples of how to totally make the applicalion loosely coupled from the Domain perspective using the IoC containers e.g. Unity or Castle (looks to be the way to go !) ...BUT Are there any GOOD examples though of this in using WSDL calls ...we are not yet using oData...just the standard wsdl.

Any help, hints appreciated...

+1  A: 

The reference application for asp.net mvc NerdDinner is a good place to start http://weblogs.asp.net/shijuvarghese/archive/2009/03/12/applying-dependency-injection-in-asp-net-mvc-nerddinner-com-application.aspx

Shiraz Bhaiji
A: 

The Service Contract for each of the WCF services for which you do an "Add Service Reference" will be an interface. Simply program against that interface.


So you have a ISomeService service contract. Pass an instance of that contract to the classes that need to interact with it:

public SomeClass(ISomeService service)
{
   this._service = service;
}

public List<Something> GetSomething()
{
   return _service.GetSomething();
}

Now you can either pass a SomeServiceClient instance, or a SomeMockService instance to the class.

John Saunders
Thanks...Shiraz and John...but it doesn't seem to tie in with my requirements."Simply program against that interface"...MmmmmI take the advice of John and Add Service Reference and I have access to the Interface but all the peripheral code seems to be SO different from one implementation to the other. I even tried using MVCTurbine to see if this would 'ease' the implementation...I am really lost here which is why I asked the question for a SOLID example of a WSDL example...Sorry for appearing so dumb...I'm obviously not seeing it !!
Dezzz