PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/src/LinFu.IoC.Common/FactoryAttribute.cs

http://github.com/philiplaureano/LinFu
C# | 39 lines | 15 code | 4 blank | 20 comment | 0 complexity | cc197604954bd4b1543d5818364c6143 MD5 | raw file
 1using System;
 2
 3namespace LinFu.IoC.Configuration
 4{
 5    /// <summary>
 6    ///     An attribute that marks a type as a custom factory.
 7    /// </summary>
 8    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
 9    public class FactoryAttribute : Attribute
10    {
11        /// <summary>
12        ///     The additional parameters supported by the custom factory.
13        /// </summary>
14        public Type[] ArgumentTypes;
15
16        /// <summary>
17        ///     The service name that will be associated
18        ///     with the service type.
19        /// </summary>
20        public string ServiceName;
21
22        /// <summary>
23        ///     Marks a target type as a custom factory
24        ///     that can create object instances that
25        ///     can implement the <paramref name="serviceType" />.
26        /// </summary>
27        /// <param name="serviceType">The service type to create.</param>
28        public FactoryAttribute(Type serviceType)
29        {
30            ServiceType = serviceType;
31        }
32
33        /// <summary>
34        ///     Gets the service type that can be created
35        ///     using the factory instance.
36        /// </summary>
37        public Type ServiceType { get; }
38    }
39}