public void reproduce() { var anotherDependency = new AnotherDependency(); var container = new Container(x => { x.Scan(s => { s.TheCallingAssembly(); s.AssembliesFromApplicationBaseDirectory(); s.WithDefaultConventions(); }); x.For <IActivityService>().Singleton(); x.ForConcreteType <ClassWithTwoConstructors>() .Configure.SelectConstructor(() => new ClassWithTwoConstructors(new AnotherDependency())) .Ctor <AnotherDependency>().Is(anotherDependency); // You don't need to specify the argument name if there is only 1 for that type //.Ctor<AnotherDependency>("anotherDependency").Is(anotherDependency); }); container.GetInstance <MainService>() .AnotherDependency.AnotherDependency.ShouldBeTheSameAs(anotherDependency); }
public void reproduce() { var anotherDependency = new AnotherDependency(); var container = new Container(x => { x.Scan(s => { s.TheCallingAssembly(); s.AssembliesFromApplicationBaseDirectory(); s.WithDefaultConventions(); }); x.For<IActivityService>().Singleton(); x.ForConcreteType<ClassWithTwoConstructors>() .Configure.SelectConstructor(() => new ClassWithTwoConstructors(new AnotherDependency())) .Ctor<AnotherDependency>().Is(anotherDependency); // You don't need to specify the argument name if there is only 1 for that type //.Ctor<AnotherDependency>("anotherDependency").Is(anotherDependency); }); container.GetInstance<MainService>() .AnotherDependency.AnotherDependency.ShouldBeTheSameAs(anotherDependency); }
protected Protected( Dependency dependency, AnotherDependency anotherDependency ) {}
public ExternalDependencyExport( Dependency dependency, AnotherDependency anotherDependency, ILogger logger ) { Selected = MethodBase.GetCurrentMethod(); }
public Exported( Dependency dependency, AnotherDependency anotherDependency, IAnotherDependencyAgain again ) { Selected = MethodBase.GetCurrentMethod(); }
public MessageSenderTwo(Producer producer, AnotherDependency anotherDependency) { ADependency = anotherDependency; Producer = producer; }
public ClassWithTwoConstructors(AnotherDependency anotherDependency) { _anotherDependency = anotherDependency; }