1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
20 /// This attribute is usefull only when you want to register all components
21 /// on an assembly as a batch process.
22 /// By doing so, the batch register will look
23 /// for this attribute to distinguish components from other classes.
25 [AttributeUsage(AttributeTargets
.Class
, AllowMultiple
=true)]
26 public class CastleComponentAttribute
: LifestyleAttribute
28 private readonly Type service
;
29 private readonly string key
;
32 /// Initializes a new instance of the <see cref="CastleComponentAttribute"/> class.
34 /// <param name="key">The key.</param>
35 public CastleComponentAttribute(String key
) : this(key
, null)
40 /// Initializes a new instance of the <see cref="CastleComponentAttribute"/> class.
42 /// <param name="key">The key.</param>
43 /// <param name="service">The service.</param>
44 public CastleComponentAttribute(String key
, Type service
) : this(key
, service
, LifestyleType
.Undefined
)
49 /// Initializes a new instance of the <see cref="CastleComponentAttribute"/> class.
51 /// <param name="key">The key.</param>
52 /// <param name="service">The service.</param>
53 /// <param name="lifestyle">The lifestyle.</param>
54 public CastleComponentAttribute(String key
, Type service
, LifestyleType lifestyle
) : base(lifestyle
)
57 this.service
= service
;
63 /// <value>The service.</value>
66 get { return service; }
72 /// <value>The key.</value>