Skip to content

Instantly share code, notes, and snippets.

@dschenkelman
Created May 9, 2014 04:57
Show Gist options
  • Save dschenkelman/5f417134279a7e3f584d to your computer and use it in GitHub Desktop.
Save dschenkelman/5f417134279a7e3f584d to your computer and use it in GitHub Desktop.
Needle Container: Fluency and Mapping Types
needleContainer
.Map<IForceEnlightened>()
.To<Jedi>()
.WithId("Yoda")
.UsingLifetime(RegistrationLifetime.Singleton)
.Commit();
needleContainer
.Map<IForceEnlightened>()
.To<Jedi>()
.UsingLifetime(RegistrationLifetime.Singleton)
.Commit();
needleContainer
.Map<IForceEnlightened>()
.To<Jedi>()
.WithId("Jedi")
.Commit();
needleContainer
.Map<IForceEnlightened>()
.To<Sith>()
.WithId("Sith")
.Commit();
INeedleContainer needleContainer = new NeedleContainer();
needleContainer
.Map<IForceEnlightened>() // when we request an IForceEnlightened
.To<Jedi>() // provide a Jedi
.Commit(); // save the mapping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment