PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/SampleLibrary/AOP/SampleTypeActivator.cs

http://github.com/philiplaureano/LinFu
C# | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 035bc4f0c615ef132a51d528faf75870 MD5 | raw file
 1using System;
 2using LinFu.AOP.Interfaces;
 3
 4namespace SampleLibrary.AOP
 5{
 6    public class SampleTypeActivator : ITypeActivator
 7    {
 8        private readonly Func<ITypeActivationContext, object> _createInstance;
 9
10        public SampleTypeActivator(Func<ITypeActivationContext, object> createInstance)
11        {
12            _createInstance = createInstance;
13        }
14
15
16        public bool CanActivate(ITypeActivationContext context)
17        {
18            return true;
19        }
20
21        public object CreateInstance(ITypeActivationContext context)
22        {
23            return _createInstance(context);
24        }
25    }
26}