Posted: September 13, 2017 at 9:11 AM Quote #192894
When I installed the system, and the first use of English system, the background is normal (the product detail page open speed is faster), but when I installed Chinese language, and is ready to use it when it becomes very slow (about 3-4 minutes), I made a preliminary test, I I found the problem, but do not know how to modify, but also very strange, the default language is used when it is the execution speed quickly, switch the language, will become very slow, here is my feeling when debugging the problem areas. Hope to get the solution and reply.

The following code will slow down after switching the language.(admin product detail page only)
----------------------------------------------------------------------
Activator.CreateInstance(type, parameterInstances.ToArray());      
----------------------------------------------------------------------

source code:
public virtual object ResolveUnregistered(Type type, ILifetimeScope scope = null)
        {
            if (scope == null)
            {
                //no scope specified
                scope = Scope();
            }
            var constructors = type.GetConstructors();
            foreach (var constructor in constructors)
            {
                try
                {
                    var parameters = constructor.GetParameters();
                    var parameterInstances = new List<object>();
                    foreach (var parameter in parameters)
                    {
                        var service = Resolve(parameter.ParameterType, scope);
                        if (service == null) throw new NopException("Unknown dependency");
                        parameterInstances.Add(service);
                    }    
                  //
                  return Activator.CreateInstance(type, parameterInstances.ToArray());          
                }
                catch (NopException)
                {

                }
            }
            throw new NopException("No constructor  was found that had all the dependencies satisfied.");
        }
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)