StructureMap

hmemcpy edited this page Dec 7, 2012 · 12 revisions

StructureMap is one of the first containers created for .NET. It has two syntax flavors, the older, more verbose one (now considered obsolete), and the newer, less verbose but fluent. Only the newer syntax is supported.

The following methods are supported both in a container instance or as instance members of a Registry.

  • For<IFoo>().Use<Foo>()

  • For(typeof(IFoo)).Use(typeof(Foo))

  • For<IFoo>().Add<Foo>()

  • Scan

  • WithDefaultConventions()

  • TheCallingAssembly()

  • AddAllTypesOf<T>()

  • AddAllTypesOf(typeof(T))

  • Assembly() - currently supports Assembly.GetExecutingAssembly() and typeof(Foo).Assembly. Other assembly sources, including local variables are currently not supported.

  • AssemblyContaining<T>()

  • AssemblyContaining(typeof(T))

  • ExcludeNamespace()

  • ExcludeNamespaceContainingType<T>()

  • ExcludeType<T>()

  • IncludeNamespace()

  • IncludeNamespaceContainingType<T>()

  • RegisterConcreteTypesAgainstTheFirstInterface()

  • SingleImplementationsOfInterface()

Not (yet) supported

  • Scan
  • Exclude - this requires reflection, and it's currently not supported
  • AssembliesFromApplicationBaseDirectory()
  • AssembliesFromPath()