private void TransformServiceInterfaces(SmartAppInfo manifest) { var enabledEntities = manifest.DataModel.Entities.Where(e => !e.IsAbstract && e.AllProperties().FirstOrDefault(p => p.IsKey) != null); foreach (var entity in enabledEntities) { var template = new IServiceTemplate(entity, manifest.Id, Constants.Version); _writingService.WriteFile(Path.Combine(_context.BasePath, template.OutputPath, $"I{entity.Id}Service.g.cs"), template.TransformText()); } }
public void RenderServiceFile(List <SearchModel> models) { if (!Directory.Exists(_outputPath + "Services\\" + NormalizeTableName + "\\")) { Directory.CreateDirectory(_outputPath + "Services\\" + NormalizeTableName + "\\"); } var serviceTemplate = new ServiceTemplate(_projectName, _tableName.Replace("_", ""), models); var output = serviceTemplate.TransformText(); var outputPath = _outputPath + "Services\\" + NormalizeTableName + "\\" + NormalizeTableName + "Service.cs"; File.WriteAllText(outputPath, output); var interfaceTemplate = new IServiceTemplate(_projectName, NormalizeTableName); var iOutPut = interfaceTemplate.TransformText(); var iOutPutPath = _outputPath + "Services\\" + NormalizeTableName + "\\I" + NormalizeTableName + "Service.cs"; File.WriteAllText(iOutPutPath, iOutPut); }
/// <summary> /// Constructor /// </summary> /// <param name="template">Requiered service template</param> public KnownServiceInfo(IServiceTemplate template) { Template = template ?? throw new ArgumentNullException(nameof(template)); }