SourceForge.net Logo

Home
StructureMap on SourceForge
Basic Architecture
Concepts
API Documentation
FAQ
Configuration Schema
    Memento Sources
    Node Normalized Xml
    Attribute Normalized Xml
    Attribute Usage
    Instance Lifecyle Scoping
Configuration Management
    StructureMapDoctor
    StructureMapExplorer
    deployment Task
    verification Task
    ValidationMethod Attribute
    Other NAnt Tasks
Troubleshooting
Singleton Injection

StructureMap

Description

StructureMap is a Dependency Injection framework that can be used to improve the architectural qualities of an object oriented system by reducing the mechanical costs of good design techniques. StructureMap can enable looser coupling between classes and their dependencies, improve the testability of a class structure, and provide generic flexibility mechanisms. Used judiciously, StructureMap can greatly enhance the opportunities for code reuse by minimizing direct coupling between classes and configuration mechanisms.

StructureMap is released under the permissive Apache 2 OSS license.  You are free to download, modify, or redistribute StructureMap in any way you see fit.

New for version 2.0

  • Full support for pluggable generic types.  IService<T> and Service<T>.  Auto wiring support for generic arguments
  • Simpler, more terse Xml configuration.  Fewer steps and less Xml.
  • Define Profile instances inline for less Xml
  • New Fluent Interface API for programmatic configuration.  If so desired, all configuration can now be done in code at application startup
  • The default StructureMap.config file is now optional
  • Use multiple configuration files additively for easier configuration of composite applications
  • Pluggable ASP.Net UserControl's
  • Inject prototype instances
  • Inject prebuilt singleton instances

Consider using StructureMap if you…

  • Require significant extensibility
  • Are using a Test-Driven Development philosophy or want to largely automate testing
  • Want to isolate a troublesome subsystem or provide smooth migration paths away from legacy interfaces
  • Need a great deal of configurable properties or plugin hot spots 

Do not use StructureMap if an application or process requires little flexibility. The abstraction and indirection afforded by StructureMap is unnecessary and even harmful in simpler systems or processes. 

Status

StructureMap is the oldest IoC/DI tool for .Net development and has been used in multiple production systems since June 2004.  The current version 2.0 was released in April 2007.  StructureMap is maintained and developed by Jeremy D. Miller, The Shade Tree Developer

Recent Articles

Feature List

  • Creates objects using the Constructor Injection pattern
  • Optionally, attach dependencies and other properties through Setter Injection (v0.90)
  • Runtime linking of object dependencies
  • Configurable object lifecycle scoping (v1.0)
  • Optional support for an Injected Singleton (v0.90)
  • Generalized support for the Plugin pattern using (almost) any type of class or interface
  • Configurable either implicitly through custom attributes or explicitly through XML configuration
  • Optional log4net integration
  • Mock Injection using built in support for NMock
  • Runtime injection of a static mock or stub (v0.90) 
  • Machine level overrides of default configuration
  • Profile overrides of default configuration -- i.e. "Remote" vs "Local" vs "Stubbed" dependency profiles
  • NAnt tasks for diagnostic verification of configuration and deployment utilities for easier continuous integration (v0.90)
  • Command line utility for troubleshooting runtime configuration issues (v0.90) 
  • Diagnostic WinForms tool for exploring and troubleshooting configuration (v1.0)
  • Uses Reflection.Emit namespace classes to create IL code on the fly for performance superior to Reflection based approaches