commonservicelocator 1.0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/net-2.0/Microsoft.Practices.ServiceLocation.XML +280 -0
- data/lib/net-2.0/Microsoft.Practices.ServiceLocation.dll +0 -0
- data/lib/net-2.0/Microsoft.Practices.ServiceLocation.pdb +0 -0
- data/lib/net-2.0/Readme.txt +71 -0
- data/lib/silverlight-3.0/Microsoft.Practices.ServiceLocation.XML +263 -0
- data/lib/silverlight-3.0/Microsoft.Practices.ServiceLocation.dll +0 -0
- data/lib/silverlight-3.0/Microsoft.Practices.ServiceLocation.pdb +0 -0
- data/lib/silverlight-3.0/Readme.txt +71 -0
- metadata +63 -0
@@ -0,0 +1,280 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<doc>
|
3
|
+
<assembly>
|
4
|
+
<name>Microsoft.Practices.ServiceLocation</name>
|
5
|
+
</assembly>
|
6
|
+
<members>
|
7
|
+
<member name="T:Microsoft.Practices.ServiceLocation.ActivationException">
|
8
|
+
<summary>
|
9
|
+
The standard exception thrown when a ServiceLocator has an error in resolving an object.
|
10
|
+
</summary>
|
11
|
+
</member>
|
12
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor">
|
13
|
+
<summary>
|
14
|
+
Initializes a new instance of the <see cref="T:System.Exception" /> class.
|
15
|
+
</summary>
|
16
|
+
</member>
|
17
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.String)">
|
18
|
+
<summary>
|
19
|
+
Initializes a new instance of the <see cref="T:System.Exception" /> class with a specified error message.
|
20
|
+
</summary>
|
21
|
+
<param name="message">
|
22
|
+
The message that describes the error.
|
23
|
+
</param>
|
24
|
+
</member>
|
25
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.String,System.Exception)">
|
26
|
+
<summary>
|
27
|
+
Initializes a new instance of the <see cref="T:System.Exception" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.
|
28
|
+
</summary>
|
29
|
+
<param name="message">
|
30
|
+
The error message that explains the reason for the exception.
|
31
|
+
</param>
|
32
|
+
<param name="innerException">
|
33
|
+
The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.
|
34
|
+
</param>
|
35
|
+
</member>
|
36
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
37
|
+
<summary>
|
38
|
+
Initializes a new instance of the <see cref="T:System.Exception" /> class with serialized data.
|
39
|
+
</summary>
|
40
|
+
<param name="info">
|
41
|
+
The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.
|
42
|
+
</param>
|
43
|
+
<param name="context">
|
44
|
+
The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.
|
45
|
+
</param>
|
46
|
+
<exception cref="T:System.ArgumentNullException">
|
47
|
+
The <paramref name="info" /> parameter is null.
|
48
|
+
</exception>
|
49
|
+
<exception cref="T:System.Runtime.Serialization.SerializationException">
|
50
|
+
The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0).
|
51
|
+
</exception>
|
52
|
+
</member>
|
53
|
+
<member name="T:Microsoft.Practices.ServiceLocation.IServiceLocator">
|
54
|
+
<summary>
|
55
|
+
The generic Service Locator interface. This interface is used
|
56
|
+
to retrieve services (instances identified by type and optional
|
57
|
+
name) from a container.
|
58
|
+
</summary>
|
59
|
+
</member>
|
60
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance(System.Type)">
|
61
|
+
<summary>
|
62
|
+
Get an instance of the given <paramref name="serviceType"/>.
|
63
|
+
</summary>
|
64
|
+
<param name="serviceType">Type of object requested.</param>
|
65
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
66
|
+
the service instance.</exception>
|
67
|
+
<returns>The requested service instance.</returns>
|
68
|
+
</member>
|
69
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance(System.Type,System.String)">
|
70
|
+
<summary>
|
71
|
+
Get an instance of the given named <paramref name="serviceType"/>.
|
72
|
+
</summary>
|
73
|
+
<param name="serviceType">Type of object requested.</param>
|
74
|
+
<param name="key">Name the object was registered with.</param>
|
75
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
76
|
+
the service instance.</exception>
|
77
|
+
<returns>The requested service instance.</returns>
|
78
|
+
</member>
|
79
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetAllInstances(System.Type)">
|
80
|
+
<summary>
|
81
|
+
Get all instances of the given <paramref name="serviceType"/> currently
|
82
|
+
registered in the container.
|
83
|
+
</summary>
|
84
|
+
<param name="serviceType">Type of object requested.</param>
|
85
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
86
|
+
the service instance.</exception>
|
87
|
+
<returns>A sequence of instances of the requested <paramref name="serviceType"/>.</returns>
|
88
|
+
</member>
|
89
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance``1">
|
90
|
+
<summary>
|
91
|
+
Get an instance of the given <typeparamref name="TService"/>.
|
92
|
+
</summary>
|
93
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
94
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
95
|
+
the service instance.</exception>
|
96
|
+
<returns>The requested service instance.</returns>
|
97
|
+
</member>
|
98
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance``1(System.String)">
|
99
|
+
<summary>
|
100
|
+
Get an instance of the given named <typeparamref name="TService"/>.
|
101
|
+
</summary>
|
102
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
103
|
+
<param name="key">Name the object was registered with.</param>
|
104
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
105
|
+
the service instance.</exception>
|
106
|
+
<returns>The requested service instance.</returns>
|
107
|
+
</member>
|
108
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetAllInstances``1">
|
109
|
+
<summary>
|
110
|
+
Get all instances of the given <typeparamref name="TService"/> currently
|
111
|
+
registered in the container.
|
112
|
+
</summary>
|
113
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
114
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
115
|
+
the service instance.</exception>
|
116
|
+
<returns>A sequence of instances of the requested <typeparamref name="TService"/>.</returns>
|
117
|
+
</member>
|
118
|
+
<member name="T:Microsoft.Practices.ServiceLocation.Properties.Resources">
|
119
|
+
<summary>
|
120
|
+
A strongly-typed resource class, for looking up localized strings, etc.
|
121
|
+
</summary>
|
122
|
+
</member>
|
123
|
+
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ResourceManager">
|
124
|
+
<summary>
|
125
|
+
Returns the cached ResourceManager instance used by this class.
|
126
|
+
</summary>
|
127
|
+
</member>
|
128
|
+
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.Culture">
|
129
|
+
<summary>
|
130
|
+
Overrides the current thread's CurrentUICulture property for all
|
131
|
+
resource lookups using this strongly typed resource class.
|
132
|
+
</summary>
|
133
|
+
</member>
|
134
|
+
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ActivateAllExceptionMessage">
|
135
|
+
<summary>
|
136
|
+
Looks up a localized string similar to Activation error occured while trying to get all instances of type {0}.
|
137
|
+
</summary>
|
138
|
+
</member>
|
139
|
+
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ActivationExceptionMessage">
|
140
|
+
<summary>
|
141
|
+
Looks up a localized string similar to Activation error occured while trying to get instance of type {0}, key "{1}".
|
142
|
+
</summary>
|
143
|
+
</member>
|
144
|
+
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocator">
|
145
|
+
<summary>
|
146
|
+
This class provides the ambient container for this application. If your
|
147
|
+
framework defines such an ambient container, use ServiceLocator.Current
|
148
|
+
to get it.
|
149
|
+
</summary>
|
150
|
+
</member>
|
151
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocator.SetLocatorProvider(Microsoft.Practices.ServiceLocation.ServiceLocatorProvider)">
|
152
|
+
<summary>
|
153
|
+
Set the delegate that is used to retrieve the current container.
|
154
|
+
</summary>
|
155
|
+
<param name="newProvider">Delegate that, when called, will return
|
156
|
+
the current ambient container.</param>
|
157
|
+
</member>
|
158
|
+
<member name="P:Microsoft.Practices.ServiceLocation.ServiceLocator.Current">
|
159
|
+
<summary>
|
160
|
+
The current ambient container.
|
161
|
+
</summary>
|
162
|
+
</member>
|
163
|
+
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase">
|
164
|
+
<summary>
|
165
|
+
This class is a helper that provides a default implementation
|
166
|
+
for most of the methods of <see cref="T:Microsoft.Practices.ServiceLocation.IServiceLocator"/>.
|
167
|
+
</summary>
|
168
|
+
</member>
|
169
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetService(System.Type)">
|
170
|
+
<summary>
|
171
|
+
Implementation of <see cref="M:System.IServiceProvider.GetService(System.Type)"/>.
|
172
|
+
</summary>
|
173
|
+
<param name="serviceType">The requested service.</param>
|
174
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error in resolving the service instance.</exception>
|
175
|
+
<returns>The requested object.</returns>
|
176
|
+
</member>
|
177
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(System.Type)">
|
178
|
+
<summary>
|
179
|
+
Get an instance of the given <paramref name="serviceType"/>.
|
180
|
+
</summary>
|
181
|
+
<param name="serviceType">Type of object requested.</param>
|
182
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
183
|
+
the service instance.</exception>
|
184
|
+
<returns>The requested service instance.</returns>
|
185
|
+
</member>
|
186
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(System.Type,System.String)">
|
187
|
+
<summary>
|
188
|
+
Get an instance of the given named <paramref name="serviceType"/>.
|
189
|
+
</summary>
|
190
|
+
<param name="serviceType">Type of object requested.</param>
|
191
|
+
<param name="key">Name the object was registered with.</param>
|
192
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
193
|
+
the service instance.</exception>
|
194
|
+
<returns>The requested service instance.</returns>
|
195
|
+
</member>
|
196
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetAllInstances(System.Type)">
|
197
|
+
<summary>
|
198
|
+
Get all instances of the given <paramref name="serviceType"/> currently
|
199
|
+
registered in the container.
|
200
|
+
</summary>
|
201
|
+
<param name="serviceType">Type of object requested.</param>
|
202
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
203
|
+
the service instance.</exception>
|
204
|
+
<returns>A sequence of instances of the requested <paramref name="serviceType"/>.</returns>
|
205
|
+
</member>
|
206
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance``1">
|
207
|
+
<summary>
|
208
|
+
Get an instance of the given <typeparamref name="TService"/>.
|
209
|
+
</summary>
|
210
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
211
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
212
|
+
the service instance.</exception>
|
213
|
+
<returns>The requested service instance.</returns>
|
214
|
+
</member>
|
215
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance``1(System.String)">
|
216
|
+
<summary>
|
217
|
+
Get an instance of the given named <typeparamref name="TService"/>.
|
218
|
+
</summary>
|
219
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
220
|
+
<param name="key">Name the object was registered with.</param>
|
221
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
222
|
+
the service instance.</exception>
|
223
|
+
<returns>The requested service instance.</returns>
|
224
|
+
</member>
|
225
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetAllInstances``1">
|
226
|
+
<summary>
|
227
|
+
Get all instances of the given <typeparamref name="TService"/> currently
|
228
|
+
registered in the container.
|
229
|
+
</summary>
|
230
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
231
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
232
|
+
the service instance.</exception>
|
233
|
+
<returns>A sequence of instances of the requested <typeparamref name="TService"/>.</returns>
|
234
|
+
</member>
|
235
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.DoGetInstance(System.Type,System.String)">
|
236
|
+
<summary>
|
237
|
+
When implemented by inheriting classes, this method will do the actual work of resolving
|
238
|
+
the requested service instance.
|
239
|
+
</summary>
|
240
|
+
<param name="serviceType">Type of instance requested.</param>
|
241
|
+
<param name="key">Name of registered service you want. May be null.</param>
|
242
|
+
<returns>The requested service instance.</returns>
|
243
|
+
</member>
|
244
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.DoGetAllInstances(System.Type)">
|
245
|
+
<summary>
|
246
|
+
When implemented by inheriting classes, this method will do the actual work of
|
247
|
+
resolving all the requested service instances.
|
248
|
+
</summary>
|
249
|
+
<param name="serviceType">Type of service requested.</param>
|
250
|
+
<returns>Sequence of service instance objects.</returns>
|
251
|
+
</member>
|
252
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.FormatActivationExceptionMessage(System.Exception,System.Type,System.String)">
|
253
|
+
<summary>
|
254
|
+
Format the exception message for use in an <see cref="T:Microsoft.Practices.ServiceLocation.ActivationException"/>
|
255
|
+
that occurs while resolving a single service.
|
256
|
+
</summary>
|
257
|
+
<param name="actualException">The actual exception thrown by the implementation.</param>
|
258
|
+
<param name="serviceType">Type of service requested.</param>
|
259
|
+
<param name="key">Name requested.</param>
|
260
|
+
<returns>The formatted exception message string.</returns>
|
261
|
+
</member>
|
262
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.FormatActivateAllExceptionMessage(System.Exception,System.Type)">
|
263
|
+
<summary>
|
264
|
+
Format the exception message for use in an <see cref="T:Microsoft.Practices.ServiceLocation.ActivationException"/>
|
265
|
+
that occurs while resolving multiple service instances.
|
266
|
+
</summary>
|
267
|
+
<param name="actualException">The actual exception thrown by the implementation.</param>
|
268
|
+
<param name="serviceType">Type of service requested.</param>
|
269
|
+
<returns>The formatted exception message string.</returns>
|
270
|
+
</member>
|
271
|
+
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocatorProvider">
|
272
|
+
<summary>
|
273
|
+
This delegate type is used to provide a method that will
|
274
|
+
return the current container. Used with the <see cref="T:Microsoft.Practices.ServiceLocation.ServiceLocator"/>
|
275
|
+
static accessor class.
|
276
|
+
</summary>
|
277
|
+
<returns>An <see cref="T:Microsoft.Practices.ServiceLocation.IServiceLocator"/>.</returns>
|
278
|
+
</member>
|
279
|
+
</members>
|
280
|
+
</doc>
|
Binary file
|
Binary file
|
@@ -0,0 +1,71 @@
|
|
1
|
+
This file explains the expected semantics IServiceLocator implementations must implement to properly conform to this interface, and a few implementation notes.
|
2
|
+
|
3
|
+
==== Specification ====
|
4
|
+
|
5
|
+
**** GetInstance(Type, string) ****
|
6
|
+
|
7
|
+
This is the core method for retrieving a single instance from the container.
|
8
|
+
|
9
|
+
This method MUST NOT return null. It MUST return either an instance that implements the requested type or throw an ActivationException.
|
10
|
+
No other exception type is allowed (except for the usual CLR rules for things like ThreadAbortException).
|
11
|
+
|
12
|
+
The implementation should be designed to expect a null for the string key parameter, and MUST interpret this as a request to get the "default" instance for the requested type. The meaning of "default" depends on the underlying container and how it is configured. A string of length 0 is considered to be different from a null, and implementers are free to choose what a string of length 0 as a key means.
|
13
|
+
|
14
|
+
**** GetAllInstances(Type) ****
|
15
|
+
|
16
|
+
This is the core method for retrieving multiple instances from the container.
|
17
|
+
|
18
|
+
If the container contains no instances of the requested type, this method MUST return an enumerator of length 0 instead of throwing an exception.
|
19
|
+
|
20
|
+
If an exception occurs while activating instances during enumeration, this method SHOULD throw an ActivationException and abort the enumeration. However, it may also choose to simply skip that object and continue enumerating.
|
21
|
+
|
22
|
+
**** Overload Behavior ****
|
23
|
+
|
24
|
+
A call to:
|
25
|
+
|
26
|
+
object IServiceLocator.GetInstance(serviceType)
|
27
|
+
|
28
|
+
MUST be exactly equivalent to a call to:
|
29
|
+
|
30
|
+
object IServiceLocator.GetInstance(serviceType, null)
|
31
|
+
|
32
|
+
A call to:
|
33
|
+
|
34
|
+
TService IServiceLocator.GetInstance<TService>()
|
35
|
+
|
36
|
+
MUST be exactly equivalent to a call to:
|
37
|
+
|
38
|
+
(TService)IServiceLocator.GetInstance(typeof(TService), null)
|
39
|
+
|
40
|
+
A call to:
|
41
|
+
|
42
|
+
TService IServiceLocator.GetInstance<TService>(key)
|
43
|
+
|
44
|
+
MUST be exactly equivalent to a call to:
|
45
|
+
|
46
|
+
(TService)IServiceLocator.GetInstance(typeof(TService), key)
|
47
|
+
|
48
|
+
A call to:
|
49
|
+
|
50
|
+
IEnumerable<TService> IServiceLocator.GetAllInstances<TService>()
|
51
|
+
|
52
|
+
Must be exactly equivalent to a call to:
|
53
|
+
|
54
|
+
IEnumerable<object> IServiceLocator.GetAllInstances(typeof(TService))
|
55
|
+
|
56
|
+
with the exception that the objects returned by the enumerator are already cast to type TService.
|
57
|
+
|
58
|
+
**** Throwing ActivationException ****
|
59
|
+
|
60
|
+
When throwing an ActivationException, the message string is explicitly undefined by this specification; the adapter implementors may format this message in any way they choose.
|
61
|
+
|
62
|
+
When throwing an ActivationException, the original exception MUST be returned as the value of the InnerException property.
|
63
|
+
|
64
|
+
==== ServiceLocatorImplBase ====
|
65
|
+
|
66
|
+
This class is not part of the specification; consumers should only reference the IServiceLocator interface. ServiceLocatorImplBase is provided as a convenience for implementors of IServiceLocator. It implements the correct overload semantics and exception wrapping behavior defined above. You just need to implement the two protected methods DoGetInstance and DoGetAllInstances and the rest will just work. In addition, the two protected methods FormatActivationExceptionMessage and FormatActivateAllExceptionMessage are provided if you wish to customize the error message reported in the exceptions.
|
67
|
+
|
68
|
+
==== Why is ActivationException a partial class? ====
|
69
|
+
|
70
|
+
Implementing ISerializable for exceptions is a .NET best practice for the desktop CLR. However, I anticipate a port to Silverlight for this code - many containers are already supporting Silverlight beta 2 or are about to. Silverlight does not support classic binary serialization. By making this a partial class and segregating the serialization details into a separate file, a future Silverlight port can simply leave the .Desktop.cs file out of the project and the incompatible code will be seamlessly removed.
|
71
|
+
|
@@ -0,0 +1,263 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<doc>
|
3
|
+
<assembly>
|
4
|
+
<name>Microsoft.Practices.ServiceLocation</name>
|
5
|
+
</assembly>
|
6
|
+
<members>
|
7
|
+
<member name="T:Microsoft.Practices.ServiceLocation.ActivationException">
|
8
|
+
<summary>
|
9
|
+
The standard exception thrown when a ServiceLocator has an error in resolving an object.
|
10
|
+
</summary>
|
11
|
+
</member>
|
12
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor">
|
13
|
+
<summary>
|
14
|
+
Initializes a new instance of the <see cref="T:System.Exception" /> class.
|
15
|
+
</summary>
|
16
|
+
</member>
|
17
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.String)">
|
18
|
+
<summary>
|
19
|
+
Initializes a new instance of the <see cref="T:System.Exception" /> class with a specified error message.
|
20
|
+
</summary>
|
21
|
+
<param name="message">
|
22
|
+
The message that describes the error.
|
23
|
+
</param>
|
24
|
+
</member>
|
25
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ActivationException.#ctor(System.String,System.Exception)">
|
26
|
+
<summary>
|
27
|
+
Initializes a new instance of the <see cref="T:System.Exception" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.
|
28
|
+
</summary>
|
29
|
+
<param name="message">
|
30
|
+
The error message that explains the reason for the exception.
|
31
|
+
</param>
|
32
|
+
<param name="innerException">
|
33
|
+
The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.
|
34
|
+
</param>
|
35
|
+
</member>
|
36
|
+
<member name="T:Microsoft.Practices.ServiceLocation.IServiceLocator">
|
37
|
+
<summary>
|
38
|
+
The generic Service Locator interface. This interface is used
|
39
|
+
to retrieve services (instances identified by type and optional
|
40
|
+
name) from a container.
|
41
|
+
</summary>
|
42
|
+
</member>
|
43
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance(System.Type)">
|
44
|
+
<summary>
|
45
|
+
Get an instance of the given <paramref name="serviceType"/>.
|
46
|
+
</summary>
|
47
|
+
<param name="serviceType">Type of object requested.</param>
|
48
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
49
|
+
the service instance.</exception>
|
50
|
+
<returns>The requested service instance.</returns>
|
51
|
+
</member>
|
52
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance(System.Type,System.String)">
|
53
|
+
<summary>
|
54
|
+
Get an instance of the given named <paramref name="serviceType"/>.
|
55
|
+
</summary>
|
56
|
+
<param name="serviceType">Type of object requested.</param>
|
57
|
+
<param name="key">Name the object was registered with.</param>
|
58
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
59
|
+
the service instance.</exception>
|
60
|
+
<returns>The requested service instance.</returns>
|
61
|
+
</member>
|
62
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetAllInstances(System.Type)">
|
63
|
+
<summary>
|
64
|
+
Get all instances of the given <paramref name="serviceType"/> currently
|
65
|
+
registered in the container.
|
66
|
+
</summary>
|
67
|
+
<param name="serviceType">Type of object requested.</param>
|
68
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
69
|
+
the service instance.</exception>
|
70
|
+
<returns>A sequence of instances of the requested <paramref name="serviceType"/>.</returns>
|
71
|
+
</member>
|
72
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance``1">
|
73
|
+
<summary>
|
74
|
+
Get an instance of the given <typeparamref name="TService"/>.
|
75
|
+
</summary>
|
76
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
77
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
78
|
+
the service instance.</exception>
|
79
|
+
<returns>The requested service instance.</returns>
|
80
|
+
</member>
|
81
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetInstance``1(System.String)">
|
82
|
+
<summary>
|
83
|
+
Get an instance of the given named <typeparamref name="TService"/>.
|
84
|
+
</summary>
|
85
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
86
|
+
<param name="key">Name the object was registered with.</param>
|
87
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
88
|
+
the service instance.</exception>
|
89
|
+
<returns>The requested service instance.</returns>
|
90
|
+
</member>
|
91
|
+
<member name="M:Microsoft.Practices.ServiceLocation.IServiceLocator.GetAllInstances``1">
|
92
|
+
<summary>
|
93
|
+
Get all instances of the given <typeparamref name="TService"/> currently
|
94
|
+
registered in the container.
|
95
|
+
</summary>
|
96
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
97
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
98
|
+
the service instance.</exception>
|
99
|
+
<returns>A sequence of instances of the requested <typeparamref name="TService"/>.</returns>
|
100
|
+
</member>
|
101
|
+
<member name="T:Microsoft.Practices.ServiceLocation.Properties.Resources">
|
102
|
+
<summary>
|
103
|
+
A strongly-typed resource class, for looking up localized strings, etc.
|
104
|
+
</summary>
|
105
|
+
</member>
|
106
|
+
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ResourceManager">
|
107
|
+
<summary>
|
108
|
+
Returns the cached ResourceManager instance used by this class.
|
109
|
+
</summary>
|
110
|
+
</member>
|
111
|
+
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.Culture">
|
112
|
+
<summary>
|
113
|
+
Overrides the current thread's CurrentUICulture property for all
|
114
|
+
resource lookups using this strongly typed resource class.
|
115
|
+
</summary>
|
116
|
+
</member>
|
117
|
+
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ActivateAllExceptionMessage">
|
118
|
+
<summary>
|
119
|
+
Looks up a localized string similar to Activation error occured while trying to get all instances of type {0}.
|
120
|
+
</summary>
|
121
|
+
</member>
|
122
|
+
<member name="P:Microsoft.Practices.ServiceLocation.Properties.Resources.ActivationExceptionMessage">
|
123
|
+
<summary>
|
124
|
+
Looks up a localized string similar to Activation error occured while trying to get instance of type {0}, key "{1}".
|
125
|
+
</summary>
|
126
|
+
</member>
|
127
|
+
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocator">
|
128
|
+
<summary>
|
129
|
+
This class provides the ambient container for this application. If your
|
130
|
+
framework defines such an ambient container, use ServiceLocator.Current
|
131
|
+
to get it.
|
132
|
+
</summary>
|
133
|
+
</member>
|
134
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocator.SetLocatorProvider(Microsoft.Practices.ServiceLocation.ServiceLocatorProvider)">
|
135
|
+
<summary>
|
136
|
+
Set the delegate that is used to retrieve the current container.
|
137
|
+
</summary>
|
138
|
+
<param name="newProvider">Delegate that, when called, will return
|
139
|
+
the current ambient container.</param>
|
140
|
+
</member>
|
141
|
+
<member name="P:Microsoft.Practices.ServiceLocation.ServiceLocator.Current">
|
142
|
+
<summary>
|
143
|
+
The current ambient container.
|
144
|
+
</summary>
|
145
|
+
</member>
|
146
|
+
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase">
|
147
|
+
<summary>
|
148
|
+
This class is a helper that provides a default implementation
|
149
|
+
for most of the methods of <see cref="T:Microsoft.Practices.ServiceLocation.IServiceLocator"/>.
|
150
|
+
</summary>
|
151
|
+
</member>
|
152
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetService(System.Type)">
|
153
|
+
<summary>
|
154
|
+
Implementation of <see cref="M:System.IServiceProvider.GetService(System.Type)"/>.
|
155
|
+
</summary>
|
156
|
+
<param name="serviceType">The requested service.</param>
|
157
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error in resolving the service instance.</exception>
|
158
|
+
<returns>The requested object.</returns>
|
159
|
+
</member>
|
160
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(System.Type)">
|
161
|
+
<summary>
|
162
|
+
Get an instance of the given <paramref name="serviceType"/>.
|
163
|
+
</summary>
|
164
|
+
<param name="serviceType">Type of object requested.</param>
|
165
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
166
|
+
the service instance.</exception>
|
167
|
+
<returns>The requested service instance.</returns>
|
168
|
+
</member>
|
169
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(System.Type,System.String)">
|
170
|
+
<summary>
|
171
|
+
Get an instance of the given named <paramref name="serviceType"/>.
|
172
|
+
</summary>
|
173
|
+
<param name="serviceType">Type of object requested.</param>
|
174
|
+
<param name="key">Name the object was registered with.</param>
|
175
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is an error resolving
|
176
|
+
the service instance.</exception>
|
177
|
+
<returns>The requested service instance.</returns>
|
178
|
+
</member>
|
179
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetAllInstances(System.Type)">
|
180
|
+
<summary>
|
181
|
+
Get all instances of the given <paramref name="serviceType"/> currently
|
182
|
+
registered in the container.
|
183
|
+
</summary>
|
184
|
+
<param name="serviceType">Type of object requested.</param>
|
185
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
186
|
+
the service instance.</exception>
|
187
|
+
<returns>A sequence of instances of the requested <paramref name="serviceType"/>.</returns>
|
188
|
+
</member>
|
189
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance``1">
|
190
|
+
<summary>
|
191
|
+
Get an instance of the given <typeparamref name="TService"/>.
|
192
|
+
</summary>
|
193
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
194
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
195
|
+
the service instance.</exception>
|
196
|
+
<returns>The requested service instance.</returns>
|
197
|
+
</member>
|
198
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance``1(System.String)">
|
199
|
+
<summary>
|
200
|
+
Get an instance of the given named <typeparamref name="TService"/>.
|
201
|
+
</summary>
|
202
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
203
|
+
<param name="key">Name the object was registered with.</param>
|
204
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
205
|
+
the service instance.</exception>
|
206
|
+
<returns>The requested service instance.</returns>
|
207
|
+
</member>
|
208
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetAllInstances``1">
|
209
|
+
<summary>
|
210
|
+
Get all instances of the given <typeparamref name="TService"/> currently
|
211
|
+
registered in the container.
|
212
|
+
</summary>
|
213
|
+
<typeparam name="TService">Type of object requested.</typeparam>
|
214
|
+
<exception cref="T:Microsoft.Practices.ServiceLocation.ActivationException">if there is are errors resolving
|
215
|
+
the service instance.</exception>
|
216
|
+
<returns>A sequence of instances of the requested <typeparamref name="TService"/>.</returns>
|
217
|
+
</member>
|
218
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.DoGetInstance(System.Type,System.String)">
|
219
|
+
<summary>
|
220
|
+
When implemented by inheriting classes, this method will do the actual work of resolving
|
221
|
+
the requested service instance.
|
222
|
+
</summary>
|
223
|
+
<param name="serviceType">Type of instance requested.</param>
|
224
|
+
<param name="key">Name of registered service you want. May be null.</param>
|
225
|
+
<returns>The requested service instance.</returns>
|
226
|
+
</member>
|
227
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.DoGetAllInstances(System.Type)">
|
228
|
+
<summary>
|
229
|
+
When implemented by inheriting classes, this method will do the actual work of
|
230
|
+
resolving all the requested service instances.
|
231
|
+
</summary>
|
232
|
+
<param name="serviceType">Type of service requested.</param>
|
233
|
+
<returns>Sequence of service instance objects.</returns>
|
234
|
+
</member>
|
235
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.FormatActivationExceptionMessage(System.Exception,System.Type,System.String)">
|
236
|
+
<summary>
|
237
|
+
Format the exception message for use in an <see cref="T:Microsoft.Practices.ServiceLocation.ActivationException"/>
|
238
|
+
that occurs while resolving a single service.
|
239
|
+
</summary>
|
240
|
+
<param name="actualException">The actual exception thrown by the implementation.</param>
|
241
|
+
<param name="serviceType">Type of service requested.</param>
|
242
|
+
<param name="key">Name requested.</param>
|
243
|
+
<returns>The formatted exception message string.</returns>
|
244
|
+
</member>
|
245
|
+
<member name="M:Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.FormatActivateAllExceptionMessage(System.Exception,System.Type)">
|
246
|
+
<summary>
|
247
|
+
Format the exception message for use in an <see cref="T:Microsoft.Practices.ServiceLocation.ActivationException"/>
|
248
|
+
that occurs while resolving multiple service instances.
|
249
|
+
</summary>
|
250
|
+
<param name="actualException">The actual exception thrown by the implementation.</param>
|
251
|
+
<param name="serviceType">Type of service requested.</param>
|
252
|
+
<returns>The formatted exception message string.</returns>
|
253
|
+
</member>
|
254
|
+
<member name="T:Microsoft.Practices.ServiceLocation.ServiceLocatorProvider">
|
255
|
+
<summary>
|
256
|
+
This delegate type is used to provide a method that will
|
257
|
+
return the current container. Used with the <see cref="T:Microsoft.Practices.ServiceLocation.ServiceLocator"/>
|
258
|
+
static accessor class.
|
259
|
+
</summary>
|
260
|
+
<returns>An <see cref="T:Microsoft.Practices.ServiceLocation.IServiceLocator"/>.</returns>
|
261
|
+
</member>
|
262
|
+
</members>
|
263
|
+
</doc>
|
Binary file
|
Binary file
|
@@ -0,0 +1,71 @@
|
|
1
|
+
This file explains the expected semantics IServiceLocator implementations must implement to properly conform to this interface, and a few implementation notes.
|
2
|
+
|
3
|
+
==== Specification ====
|
4
|
+
|
5
|
+
**** GetInstance(Type, string) ****
|
6
|
+
|
7
|
+
This is the core method for retrieving a single instance from the container.
|
8
|
+
|
9
|
+
This method MUST NOT return null. It MUST return either an instance that implements the requested type or throw an ActivationException.
|
10
|
+
No other exception type is allowed (except for the usual CLR rules for things like ThreadAbortException).
|
11
|
+
|
12
|
+
The implementation should be designed to expect a null for the string key parameter, and MUST interpret this as a request to get the "default" instance for the requested type. The meaning of "default" depends on the underlying container and how it is configured. A string of length 0 is considered to be different from a null, and implementers are free to choose what a string of length 0 as a key means.
|
13
|
+
|
14
|
+
**** GetAllInstances(Type) ****
|
15
|
+
|
16
|
+
This is the core method for retrieving multiple instances from the container.
|
17
|
+
|
18
|
+
If the container contains no instances of the requested type, this method MUST return an enumerator of length 0 instead of throwing an exception.
|
19
|
+
|
20
|
+
If an exception occurs while activating instances during enumeration, this method SHOULD throw an ActivationException and abort the enumeration. However, it may also choose to simply skip that object and continue enumerating.
|
21
|
+
|
22
|
+
**** Overload Behavior ****
|
23
|
+
|
24
|
+
A call to:
|
25
|
+
|
26
|
+
object IServiceLocator.GetInstance(serviceType)
|
27
|
+
|
28
|
+
MUST be exactly equivalent to a call to:
|
29
|
+
|
30
|
+
object IServiceLocator.GetInstance(serviceType, null)
|
31
|
+
|
32
|
+
A call to:
|
33
|
+
|
34
|
+
TService IServiceLocator.GetInstance<TService>()
|
35
|
+
|
36
|
+
MUST be exactly equivalent to a call to:
|
37
|
+
|
38
|
+
(TService)IServiceLocator.GetInstance(typeof(TService), null)
|
39
|
+
|
40
|
+
A call to:
|
41
|
+
|
42
|
+
TService IServiceLocator.GetInstance<TService>(key)
|
43
|
+
|
44
|
+
MUST be exactly equivalent to a call to:
|
45
|
+
|
46
|
+
(TService)IServiceLocator.GetInstance(typeof(TService), key)
|
47
|
+
|
48
|
+
A call to:
|
49
|
+
|
50
|
+
IEnumerable<TService> IServiceLocator.GetAllInstances<TService>()
|
51
|
+
|
52
|
+
Must be exactly equivalent to a call to:
|
53
|
+
|
54
|
+
IEnumerable<object> IServiceLocator.GetAllInstances(typeof(TService))
|
55
|
+
|
56
|
+
with the exception that the objects returned by the enumerator are already cast to type TService.
|
57
|
+
|
58
|
+
**** Throwing ActivationException ****
|
59
|
+
|
60
|
+
When throwing an ActivationException, the message string is explicitly undefined by this specification; the adapter implementors may format this message in any way they choose.
|
61
|
+
|
62
|
+
When throwing an ActivationException, the original exception MUST be returned as the value of the InnerException property.
|
63
|
+
|
64
|
+
==== ServiceLocatorImplBase ====
|
65
|
+
|
66
|
+
This class is not part of the specification; consumers should only reference the IServiceLocator interface. ServiceLocatorImplBase is provided as a convenience for implementors of IServiceLocator. It implements the correct overload semantics and exception wrapping behavior defined above. You just need to implement the two protected methods DoGetInstance and DoGetAllInstances and the rest will just work. In addition, the two protected methods FormatActivationExceptionMessage and FormatActivateAllExceptionMessage are provided if you wish to customize the error message reported in the exceptions.
|
67
|
+
|
68
|
+
==== Why is ActivationException a partial class? ====
|
69
|
+
|
70
|
+
Implementing ISerializable for exceptions is a .NET best practice for the desktop CLR. However, I anticipate a port to Silverlight for this code - many containers are already supporting Silverlight beta 2 or are about to. Silverlight does not support classic binary serialization. By making this a partial class and segregating the serialization details into a separate file, a future Silverlight port can simply leave the .Desktop.cs file out of the project and the incompatible code will be seamlessly removed.
|
71
|
+
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: commonservicelocator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Microsoft Patterns & Practices
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
date: 2010-08-14 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
description: commonservicelocator is a DI abstract container for .NET
|
21
|
+
email: pnp@microsoft.com
|
22
|
+
executables: []
|
23
|
+
extensions: []
|
24
|
+
extra_rdoc_files: []
|
25
|
+
files:
|
26
|
+
- lib/net-2.0/Microsoft.Practices.ServiceLocation.dll
|
27
|
+
- lib/net-2.0/Microsoft.Practices.ServiceLocation.pdb
|
28
|
+
- lib/net-2.0/Microsoft.Practices.ServiceLocation.XML
|
29
|
+
- lib/net-2.0/Readme.txt
|
30
|
+
- lib/silverlight-3.0/Microsoft.Practices.ServiceLocation.dll
|
31
|
+
- lib/silverlight-3.0/Microsoft.Practices.ServiceLocation.pdb
|
32
|
+
- lib/silverlight-3.0/Microsoft.Practices.ServiceLocation.XML
|
33
|
+
- lib/silverlight-3.0/Readme.txt
|
34
|
+
has_rdoc: true
|
35
|
+
homepage: http://commonservicelocator.codeplex.com
|
36
|
+
licenses: []
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
none: true
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
none: true
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project: commonservicelocator
|
59
|
+
rubygems_version: 1.3.7
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: Microsoft Patterns & Practices Common Service Locator
|
63
|
+
test_files: []
|