Using ContactManager sample as an example - there should be a way to have a container build the ContactsResource, injecting IContactRepository instead of having it explicitly instantiated in default constructor as it is now. The framework should then resolve ContactsResource against the container. I imagine that instead of using concrete ContactsResource implementation this could be also done for interfaces (assuming we would register and interface in Global.asax.cs : RouteTable.Routes.AddServiceRoute<IContactsResource>("contacts", configuration);).
[ServiceContract]
public class ContactsResource
{
private readonly IContactRepository repository;
public ContactsResource(IContactRepository repository)
{
this.repository = repository;
}
public ContactsResource()
: this(new ContactRepository())
{
}
[...]