Created
April 9, 2013 07:14
-
-
Save JakeGinnivan/5343635 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Foo : IFoo | |
| { | |
| public Foo(string state, ISomeDepedency dep){} | |
| } | |
| public interface IFooFactory | |
| { | |
| IFoo Create(string state); | |
| } | |
| public class FooFactory : IFooFactory | |
| { | |
| ISOmeDep _dep; | |
| public FooFactory(ISomeDependency dep){ | |
| _dep = dep; | |
| } | |
| public IFoo Create(string state) | |
| { | |
| return new Foo(state, _dep); | |
| } | |
| } | |
| public void ContainerConfiguration(ContainerBuilder cb) | |
| { | |
| cb.RegisterType<FooFactory>().As<IFooFactory>().InstancePerHttpRequest(); | |
| cb.RegisterType<SomeDependency>().As<ISomeDependency>().InstancePerHttpRequest(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment