/
NodeNormalized.htm
201 lines (194 loc) · 23.4 KB
/
NodeNormalized.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Title</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<TABLE cellSpacing="5" cellPadding="0" width="100%" border="0" height="100%">
<TR>
<TD valign="top" width="210" class="form">
<p align="center">
<A href="http://sourceforge.net"><IMG src="http://sourceforge.net/sflogo.php?group_id=104740&type=5" width="210" height="62"
border="0" alt="SourceForge.net Logo"></A>
</p>
<P style="LINE-HEIGHT: 25px">
<A href="default.htm">Home</A><BR>
<a href="http://sourceforge.net/projects/structuremap">StructureMap on SourceForge</a><br>
<A href="Basic Architecture.htm">Basic Architecture</A><BR>
<A href="Concepts.htm">Concepts</A><BR>
<A href="StructureMap-API.chm">API Documentation</A><BR>
<A href="FAQ.htm">FAQ</A><BR>
<A href="Configuration.htm">Configuration Schema</A><BR>
<a href="MementoSources.htm">Memento Sources</a><BR>
<a href="NodeNormalized.htm">Node Normalized Xml</a><BR>
<a href="AttributeNormalized.htm">Attribute
Normalized Xml</a><BR>
<a href="Attributes.htm">Attribute Usage</a><BR>
<a href="Scoping.htm">Instance Lifecyle Scoping</a><BR>
<A href="ConfigurationManagement.htm">Configuration Management</A><BR>
<A href="StructureMapDoctor.htm">StructureMapDoctor</A><BR>
<A href="StructureMapExplorer.htm">StructureMapExplorer</A><BR>
<A href="structuremap.deployment.htm">deployment Task</A><BR>
<A href="structuremap.verification.htm">verification Task</A><BR>
<A href="ValidationAttribute.htm">ValidationMethod Attribute</A><BR>
<A href="NAnt Tasks.htm">Other NAnt Tasks</A><BR>
<A href="Troubleshooting.htm">Troubleshooting</A><BR>
<A href="SingletonInjection.htm">Singleton Injection</A></P>
</TD>
<TD valign="top" style="PADDING-LEFT: 25px">
<h1>Node Normalized Xml Mementos</h1>
<p>This is the default style used for instances within the
StructureMap.config file.</p>
<h4>Primitive Properties (Strings and basic value types)</h4>
<p>Primitive constructor or setter arguments are defined by adding a
<Property Name="propertyName" Value="propertyValue"> node
underneath the instance node.</p>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> [Pluggable("Color", "Only for testing")]</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> ColorWidget : IWidget</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> ColorWidget(<span style="color: blue;">string</span> Color)</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> _Color = Color;</pre>
<pre style="margin: 0px;"> }</pre>
<pre style="margin: 0px;"> }</pre>
</div>
<br>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Widget</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Color"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Red"></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="Color"</span><span style="color: fuchsia;"> </span><span style="color: red;">Value</span><span style="color: blue;">="Red"</span><span style="color: fuchsia;"> </span><span style="color: blue;">/></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">Widget</span><span style="color: blue;">></span></pre>
</div>
<h4>Long Strings</h4>
<p>There is an optional mode to define a property value
inside a CDATA tag for very long strings like sql statements
or Javascript templates. </p>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="bigProp"></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><![</span><span style="color: fuchsia;">CDATA[</span></pre>
<pre style="margin: 0px;"><span style="color: fuchsia;"> select </span><span style="color: blue;">*</span><span style="color: fuchsia;"> from table</span></pre>
<pre style="margin: 0px;"><span style="color: fuchsia;"> where</span></pre>
<pre style="margin: 0px;"><span style="color: fuchsia;"> somecolumn = </span><span style="color: blue;">'something'</span><span style="color: fuchsia;"> or</span></pre>
<pre style="margin: 0px;"><span style="color: fuchsia;"> some_other_column = </span><span style="color: blue;">'something else'</span></pre>
<pre style="margin: 0px;"><span style="color: fuchsia;"> </span><span style="color: blue;">]]></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">Property</span><span style="color: blue;">></span></pre>
</div>
<h4>Enumeration Properties</h4>
<p>Enumeration arguments are defined the same way as
primitive properties. Use the string names of the
enumeration for the values.</p>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">enum</span> BreedEnum</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> Hereford,</pre>
<pre style="margin: 0px;"> Angus,</pre>
<pre style="margin: 0px;"> Longhorn</pre>
<pre style="margin: 0px;"> }</pre>
<pre style="margin: 0px;"> </pre>
<pre style="margin: 0px;"> [Pluggable("Cow")]</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> Cow</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> BreedEnum Breed;</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">long</span> Weight;</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">string</span> Name;</pre>
<pre style="margin: 0px;"> </pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> Cow(<span style="color: blue;">long</span> Weight, BreedEnum Breed, <span style="color: blue;">string</span> Name)</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> <span style="color: blue;">this</span>.Breed = Breed;</pre>
<pre style="margin: 0px;"> <span style="color: blue;">this</span>.Weight = Weight;</pre>
<pre style="margin: 0px;"> <span style="color: blue;">this</span>.Name = Name;</pre>
<pre style="margin: 0px;"> }</pre>
<pre style="margin: 0px;"> }</pre>
</div>
<br>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: #800000">Instance</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Cow"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Maggie"></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="Breed"</span><span style="color: fuchsia;"> </span><span style="color: red;">Value</span><span style="color: blue;">="Angus"</span><span style="color: fuchsia;"> </span><span style="color: blue;">/></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: #800000">Instance</span><span style="color: blue;">></span></pre>
</div>
<h4>Child Properties</h4>
<p>Child properties of non-primitive types are defined as
embedded memento nodes. Child properties can be either
defined inline or use a reference to a named instance of the
property type. If a child property is omitted or
defined with no value, StructureMap will use the default
instance of the property type.</p>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> [PluginFamily, Pluggable("Default", "")]</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> GrandChild</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> GrandChild(<span style="color: blue;">bool</span> RightHanded, <span style="color: blue;">int</span> BirthYear)</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> }</pre>
<pre style="margin: 0px;"> }</pre>
<pre style="margin: 0px;"> </pre>
<pre style="margin: 0px;"> </pre>
<pre style="margin: 0px;"> [Pluggable("Leftie", "")]</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> LeftieGrandChild : GrandChild</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> LeftieGrandChild(<span style="color: blue;">int</span> BirthYear) : <span style="color: blue;">base</span>(<span style="color: blue;">false</span>, BirthYear)</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> }</pre>
<pre style="margin: 0px;"> }</pre>
<pre style="margin: 0px;"> </pre>
<pre style="margin: 0px;"> </pre>
<pre style="margin: 0px;"> [PluginFamily, Pluggable("Default", "")]</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> Child</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> Child(<span style="color: blue;">string</span> Name, GrandChild MyGrandChild)</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> }</pre>
<pre style="margin: 0px;"> }</pre>
</div>
<br>
<h4>Inline Definition</h4>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">StructureMap.Testing.Widget.Child</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Default"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Tom"></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="Name"</span><span style="color: fuchsia;"> </span><span style="color: red;">Value</span><span style="color: blue;">="Tom"</span><span style="color: fuchsia;"> </span><span style="color: blue;">/></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="MyGrandChild"</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Leftie"></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="BirthYear"</span><span style="color: fuchsia;"> </span><span style="color: red;">Value</span><span style="color: blue;">="1984"</span><span style="color: fuchsia;"> </span><span style="color: blue;">/></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">Property</span><span style="color: blue;">></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">StructureMap.Testing.Widget.Child</span><span style="color: blue;">></span></pre>
</div>
<h4>Reference Definition</h4>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">StructureMap.Testing.Widget.Child</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Default"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Marsha"></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="Name"</span><span style="color: fuchsia;"> </span><span style="color: red;">Value</span><span style="color: blue;">="Marsha"/></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="MyGrandChild"</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Tommy"/></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">StructureMap.Testing.Widget.Child</span><span style="color: blue;">></span> </pre>
</div>
<h3>Child Array Property</h3>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> [Pluggable("Compound")]</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> CompoundStrategy : IStrategy</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> <span style="color: blue;">public</span> CompoundStrategy(IStrategy[] innerStrategies)</pre>
<pre style="margin: 0px;"> {</pre>
<pre style="margin: 0px;"> }</pre>
<pre style="margin: 0px;"> }</pre>
</div>
<br>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt;">
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Instance</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="ArrayTest"</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Compound"></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="innerStrategies"></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><!</span><span style="color: green;">-- Referenced Instance --</span><span style="color: blue;">></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Key</span><span style="color: blue;">="Red"></</span><span style="color: maroon;">Property</span><span style="color: blue;">></span></pre>
<pre style="margin: 0px;"> </pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: blue;">><!</span><span style="color: green;">-- Default Instance --</span><span style="color: blue;">></</span><span style="color: maroon;">Property</span><span style="color: blue;">></span></pre>
<pre style="margin: 0px;"> </pre>
<pre style="margin: 0px;"> <span style="color: blue;"><!</span><span style="color: green;">-- Inline Definition --</span><span style="color: blue;">></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Type</span><span style="color: blue;">="Random"></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"><</span><span style="color: maroon;">Property</span><span style="color: fuchsia;"> </span><span style="color: red;">Name</span><span style="color: blue;">="seed"</span><span style="color: fuchsia;"> </span><span style="color: red;">Value</span><span style="color: blue;">="0.034"/></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">Property</span><span style="color: blue;">></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">Property</span><span style="color: blue;">></span></pre>
<pre style="margin: 0px;"> <span style="color: blue;"></</span><span style="color: maroon;">Instance</span><span style="color: blue;">></span></pre>
</div>
<p></p>
</TD>
</TR>
</TABLE>
</body>
</html>