I am fairly new to Unity, (well, IoC and DI in general), and am having problems configuring it for my use.
I have two interfaces:
public interface ISample { ... }
and
public interface IDerivedSample : ISample { ... }
and a number of concreate classes simular to:
public class UseSample : IDerivedSample { ... }
I am attempting to configure Unity to resolve these when used like this:
public class UsesSample
{
private ISample _sample;
public UsesSample(ISample sample)
{
_sample = sample;
}
}
My attempts at getting this configured is failing, so I thought I would ask the crowd on how to do so.
EDIT
I have already configured the container to find the different versions of the interfaces by name, so the resulting code for resolving UserSample should be simular to:
ISample = contianer.Resolve<ISample>("derived");
However, it is failing.