private void CreateClassFromTemplate( string org, string service, Dictionary <ServiceEventType, string> eventLogic, Dictionary <string, string> methods, ServiceMetadata serviceMetadata) { eventLogic.OrderBy(x => x.Key); // Read the serviceImplemenation template string textData = File.ReadAllText(_generalSettings.GeneratedMethodsTemplate, Encoding.UTF8); // Replace the template default namespace List <string> formattingElements = eventLogic.Values.ToList(); formattingElements.Add(string.Join("\n", methods.Values)); textData = textData.Replace(CodeGeneration.ServiceNamespaceTemplateDefault, string.Format(CodeGeneration.ServiceNamespaceTemplate, org, service)); textData = string.Format(textData, formattingElements.ToArray()); // Create the service implementation folder Directory.CreateDirectory(_settings.GetImplementationPath(org, service, AuthenticationHelper.GetDeveloperUserName(_httpContextAccessor.HttpContext))); // Get the file path string generatedMethodsFilePath = _settings.GetImplementationPath(org, service, AuthenticationHelper.GetDeveloperUserName(_httpContextAccessor.HttpContext)) + _settings.GeneratedMethodsFileName; textData = textData.Replace(CodeGeneration.DefaultServiceModelName, serviceMetadata.Elements.Values.First(el => el.ParentElement == null).ID); File.WriteAllText(generatedMethodsFilePath, textData, Encoding.UTF8); }