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

/src/SampleLibrary/IOC/SampleFactoryWithConstructorArguments.cs

http://github.com/philiplaureano/LinFu
C# | 26 lines | 21 code | 5 blank | 0 comment | 2 complexity | 60df036951024cc7846dafc833e490af MD5 | raw file
 1using System;
 2using LinFu.IoC.Configuration;
 3using LinFu.IoC.Interfaces;
 4
 5namespace SampleLibrary.IOC
 6{
 7    [Factory(typeof(string), ServiceName = "SampleFactoryWithConstructorArguments")]
 8    public class SampleFactoryWithConstructorArguments : IFactory
 9    {
10        public ISampleService _sample;
11
12        public SampleFactoryWithConstructorArguments(ISampleService service)
13        {
14            if (service == null)
15                throw new ArgumentNullException("service");
16
17            _sample = service;
18        }
19
20
21        public object CreateInstance(IFactoryRequest request)
22        {
23            return "42";
24        }
25    }
26}