/// <summary> /// Returns the serviceImplementation for a given service. /// </summary> /// <param name="org">The Organization code for the service owner.</param> /// <param name="service">The service code for the current service.</param> /// <param name="startServiceFlag">Flag to determine if the service should run/re-run.</param> /// <returns>The service Implementation</returns> public IServiceImplementation GetServiceImplementation(string org, string service, bool startServiceFlag) { string assemblykey = org + "_" + service; string implementationTypeName = null; Type type = null; if (_assemblyNames.ContainsKey(assemblykey)) { implementationTypeName = string.Format(CodeGeneration.ServiceNamespaceTemplate, org, service) + ".ServiceImplementation," + _assemblyNames[assemblykey]; type = Type.GetType(implementationTypeName); if (type != null) { return((IServiceImplementation)Activator.CreateInstance(Type.GetType(implementationTypeName))); } } implementationTypeName = string.Format(CodeGeneration.ServiceNamespaceTemplate, org, service) + ".ServiceImplementation"; Assembly asm = AssemblyLoadContext.Default.LoadFromAssemblyPath(_settings.BaseResourceFolderContainer + _settings.GetBinaryFolder() + "AltinnService.dll"); type = asm.GetType(implementationTypeName); if (type != null) { _assemblyNames.Add(assemblykey, asm.FullName); } dynamic serviceImplementation = Activator.CreateInstance(type); return((IServiceImplementation)serviceImplementation); }