-1
Having puzzled the opening time of the V10 Spring engine in the extensibility solutions we developed (6 to 10 seconds, depending on the machine), I performed a debug log where I detected that by invoking the engine opening, the "solve" of the Spring libraries loads, if not all, almost all libraries available in the application’s "Apl" folder during engine opening.
In the V9, at the opening of the engine, only 2 (the necessary ones) were loaded: Interop.Erpbs900 and Interop.Stdbe900.
Below I let the opening code of the engine and the resolve:
var stdBeTrans = new StdPlatBS100.StdPlatBS();
erpAdminEngine = new ErpBS100.ErpBS();
erpAdminEngine.AbrePRIEMPRE((Interop.StdBE900.EnumTipoPlataforma)ErpAPI.ErpPlatformType, ErpAPI.ErpUser, ErpAPI.ErpUserPassword, stdBeTrans, ErpAPI.ErpInstance);
...
private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
var assemblyName = new System.Reflection.AssemblyName(args.Name);
var assemblyFullName =
System.IO.Path.Combine(
System.IO.Path.Combine(Environment.GetFolderPath(SYSTEM_FILES_FOLDER),
ERP_FILES_FOLDER),
assemblyName.Name + ".dll");
if (System.IO.File.Exists(assemblyFullName))
return System.Reflection.Assembly.LoadFile(assemblyFullName);
else
return null;
}
EDIT: For those interested, after some research I finally realized, and learn, that the loading of the dependencies via Reflection with Assembly.LoadFile
scans the library and loads all its dependencies into the AppDomain
before they were necessary. As in Spring v.10 I do not believe there is need to load libraries with the same identity of different paths, the big difference to the alternative, the solution is to use Assembly.LoadFrom
. This change reduces the time taken by "Resolve" without compromising integration.
Having said that, just make the following substitution in the above code:
if (System.IO.File.Exists(assemblyFullName))
return System.Reflection.Assembly.LoadFrom(assemblyFullName);
//return System.Reflection.Assembly.LoadFile(assemblyFullName);
else
return null;
Still, the time of the first engine opening is comparatively much higher than that of the spring v.9.
Make your edit turn an answer to your question. You can even answer it and mark as accepted.
– CypherPotato