public string SayHelloWithABar(IBar bar) { IFoo foo = _fooFactory.CreateFoo(bar); // do something with your 'foo' instance ... return("hello!"); }
public NeedsFooAtRuntime(IFooFactory factory) { this.foo = factory.CreateFoo("test"); }
public void DoSomething() { var foo = fooFactory.CreateFoo(); //Do whatever with foo //Your foo is now injected with another service and settings too:) }