So if you have used a repository pattern with WCF and tried to run the built-in WCF Client app you most likely have seen this error:

The service type provided could not be loaded as a service because it does not have a default (parameter-less) constructor. To fix the problem, add a default constructor to the type, or pass an instance of the type to the host.

You get this when your Servce class looks something like this:

public class SiteService : Service, ISiteService
private readonly IRepositoryAsync _asynRepository;

public SiteService(IRepositoryAsync repository)
: base(repository)
_asynRepository = repository;

That is expected because the IInstanceProvider only works with empty default constructors (with a few exceptions) and as you can see we are expecting a dependency.  In this case a repository, but it could be any dependency such as another service.

Anyway, I know Ninject provides a solution you can get from the Nuget library via the Ninject.Extensions.Wcf, but…. I want to try out using Unity and from what I understand there are community supported solutions too.

…. More to come…