Here's my scenario: I have a ISampleProvider interface:
public interface ISampleProvider<TEntity>
{
TEntity Entity{get;}
}
and here's an implementation for this interface:
public class SampleProvider<TEntity>:ISampleProvider<TEntity>
{
public SampleProvider(TEntity entity)
{
Entity=entity;
}
public TEntity Entity
{
get;private set;
}
}
I'd like to inject an entity into SampleProvider when I resolve it from WindsorContainer So I wrote this:
var container=new WindsorContainer();
container.AddComponent("smaple_provider",typeof(ISampleProvider<Person>),typeof(SampleProvider<Person>));
var arguments=new Hashtable{{"entity",new Person()}};
var sampleProvider=container.Resolve<ISampleProvider<Person>>(arguments);
But it's not working and a dependency resolver exception is thrown that says "Cycle detected in configuration "
Obviously I'm doing something wrong.