
linfu - issue #32
LinFu ICO Container is very slow when using LoadFrom(dir, fileName) to register service.
What steps will reproduce the problem? 1. New class library, and implement an interface, place [Implements(typeof (ITableProcesses))] attribute on the class. 2. Using LinFuContainer.LoadFrom (AppDomain.CurrentDomain.BaseDirectory, "My.Framework.dll"); to register services when application startup, LinFuContainer is static readonly field. 3. Call LinFuContainer.GetService<ITableProcesses>(); to obtain the instance that implements ITableProcesses interface.
What is the expected output? What do you see instead? The LinFuContainer.GetService() process is very slow, cost about 1-2 second. I use ITableProcesses obj = new ITableProcesses() to instead of LinFuContainer.GetService(), It's very fast.
I tried to use LinFuContainer.Container.Inject<ITableProcesses> ().Using<TableProcesses>().OncePerRequest() to register service, It's as well as fast.
Then I tried to change the class attribute to [Implements(typeof (ITableProcesses), LifecycleType.Singleton)] and found GetService() method is faster than the first situation.
Whether LinFu check the assembly file every time when calling container.GetService() ?
What version of the product are you using? On what operating system? Linfu 2.0,windows xp,visual studio 2008
Please provide any additional information below.
Comment #1
Posted on Aug 19, 2009 by Massive BirdThis is a known issue and you can get around this by calling the following extension methods on the service container class:
DisableAutoFieldInjection(); DisableAutoMethodInjection();
and if you're not using auto property injection, you can also call the DisableAutoPropertyInjection() method.
That should take care of your speed problem. Try it out, and let me know if helps. Thanks!
Comment #2
Posted on Aug 20, 2009 by Massive Bird(No comment was entered for this change.)
Status: Verified
Labels:
Type-Defect
Priority-Medium