/// <summary> /// Creates a new named service, which specializes another service. /// </summary> /// <param name="serviceName">Name of the new service</param> /// <param name="generalization">Specialized service</param> /// <returns>New service</returns> /// <remarks>Cannot be used when engine is running.</remarks> internal ServiceInfo CreateNewService(string serviceName, ServiceInfo generalization = null) { Debug.Assert(serviceName != null); Debug.Assert(_serviceInfos.Any(x => x.ServiceFullName == serviceName) == false, "Service does not exist and can be added"); if (generalization != null) { Debug.Assert(ServiceInfos.Contains(generalization)); } ServiceInfo newService = new ServiceInfo(serviceName, AssemblyInfoHelper.ExecutingAssemblyInfo, generalization); CreateLabService(newService); _serviceInfos.Add(newService); // Throws on duplicate return(newService); }