|
Home |
Configuration Schema
StructureMap <StructureMap> ElementThe root element of all StructureMap.config files Sample<StructureMap DefaultProfile="MyProfile">
<Include /> Optional Attributes
<Include> ElementAllows a StructureMap.config to include the <PluginFamily> and instances from additional StructureMap configuration files. This is useful in cases where a large component may have its own StructureMap.config file that is copied into the parent systems source code tree. Sample<StructureMap DefaultProfile="MyProfile"> Required Attributes
<Assembly> ElementInstructs StructureMap to search the specified assembly for possible PluginFamily interfaces and Plugin classes Sample<Assembly Name="MyApplication.Common" Deploy="All"/> <Assembly Name="MyApplication.Persistence" Deploy="Server,Batch,Build"/> Required Attributes
Optional Attributes
Back to Top <Instances> ElementA container node for InstanceMemento nodes. Can be used as a catch all MementoSource. May be deprecated in later versions of StructureMap Sample<Instances> <StructureMap.Testing.Widget.WidgetMaker Type="Color" Key="Red"> <Property Name="Color" Value="Red" /> </StructureMap.Testing.Widget.WidgetMaker> </Instances> Back to Top <log4net> ElementThe root node for log4net configuration. See http://log4net.sourceforge.net for details Back to Top <Machine> ElementMachine level overrides for default instances of one or more PluginFamily’s. New in version 2.0 is the ability to define the instance for the type specified by the Type attribute inline in an embedded <Instance> node Sample
<Machine Name="SERVER" Profile="Local">
<Override Type="StructureMap.Testing.Widget.IWidget" DefaultKey="Orange"/>
</Machine>
<Override Type="StructureMap.Testing.Widget.Rule">
<Instance Type="Color" Color="Green"/>
</Override>
Required Attributes
Optional Attributes
Back to Top <PluginFamily> ElementRepresents an explicit declaration of a PluginFamily. Explicitly directs and configures StructureMap to create instances of the CLR Type specified by the "Type" attribute Sample<PluginFamily Type="StructureMap.Testing.Widget.Rule" Assembly="StructureMap.Testing.Widget" DefaultKey="Blue" Scope="Singleton"> <Interceptors/> Required Attributes
Optional Attributes
Back to Top <DefaultInstance> ElementShorthand way to explicitly define the default instance of a PluginType in one element. Explicitly directs and configures StructureMap to create instances of the CLR Type specified by the "PluginType" attribute. The DefaultInstance node also represents an Instance node, and the arguments to the constructor function and setter properties follow the same rules as an Instance node. Sample<DefaultInstance PluginType="StructureMap.Testing.Widget.Rule,StructureMap.Testing" PluggedType="StructureMap.Testing.Widget.ColorRule,StructureMap.Testing" Scope="Singleton"> Color="Red" Required Attributes
Optional Attributes
Back to Top <Profile> ElementModels a named set of overrides for default instances of one or more PluginFamily’s. Profile level overrides supercede machine level overrides Sample<Profile Name="Blue"> <Override Type="StructureMap.Testing.Widget.Rule" DefaultKey="Blue"/> <Override Type="StructureMap.Testing.Widget.IWidget" DefaultKey="Blue"/> </Profile> <Override Type="StructureMap.Testing.Widget.Rule"> <Instance Type="Color" Color="Green"/> </Override> Required Attributes
<Instance> ElementConfigures an object instance within a PluginFamily Sample<PluginFamily> Required Attributes
Optional Attributes
<Interceptors> ElementOptional within a <PluginFamily> element, holds an ordered array of <Interceptor> elements. Sample<PluginFamily>Back to Top <Interceptor> ElementDefines an InstanceFactoryInterceptor to decorate the InstanceFactory for a PluginFamily. As of version 0.90 the only option is a Singleton interceptor to create the Injected Singleton. In later releases this will be the mechanism for caching and security. The <Interceptor> node has the same structure as the <Instance> node. Sample<Interceptors> Required Attributes
Back to Top <Override> ElementWithin a Machine or Profile node, overrides the name of the default InstanceKey for a particular PluginFamily Sample<Override Type="StructureMap.Testing.Widget.IWidget" DefaultKey="Orange"/> Required Attributes
Back to Top <Plugin> ElementExplicitly defines a concrete class as a Plugin to a PluginFamily. Useful for classes that are outside of your codebase. Sample<PluginFamily Type="StructureMap.Testing.Widget.IWidget" Assembly="StructureMap.Testing.Widget" DefaultKey="Red"> <Plugin Assembly="StructureMap.Testing.Widget" Type="StructureMap.Testing.Widget.NotPluggableWidget" ConcreteKey="NotPluggable"> Required Attributes
Back to Top <Setter> ElementExplicitly marks a property on the plugged type for setter injection. Directs StructureMap to set the value of the property from an InstanceMemento. Useful for classes that are outside of your codebase. < H4> Sample< /H4><Plugin> Required Attributes
Back to Top <Source> ElementOverrides the default MementoSource for a PluginFamily with a configured MementoSource. The specific properties of the configured MementoSource object are named attributes on the Source node itself Sample<PluginFamily> Required Attributes
Back to Top <Property> ElementModels a name/value parameter to the configured object instance constructor function. Property nodes can be nested in the case of object hierarchies Sample<Instance> Required Attributes
Optional Attributes
Back to Top |