/// <summary> /// Get partial templates. /// </summary> /// <param name="language">Language option.</param> /// <returns>Partial templates.</returns> protected override IDictionary <string, string> GetPartialTemplates( LanguageOptions language = LanguageOptions.CSharp) { EntitiesTemplateFiles.TryGetValue(Constants.EntityTypeCtorTemplate, out TemplateFileInfo ctorFile); var ctorTemplateFile = FileService.RetrieveTemplateFileContents( ctorFile.RelativeDirectory, ctorFile.FileName); EntitiesTemplateFiles.TryGetValue(Constants.EntityTypeImportTemplate, out TemplateFileInfo importFile); var importTemplateFile = FileService.RetrieveTemplateFileContents( importFile.RelativeDirectory, importFile.FileName); EntitiesTemplateFiles.TryGetValue(Constants.EntityTypePropertyTemplate, out TemplateFileInfo propertyFile); var propertyTemplateFile = FileService.RetrieveTemplateFileContents( propertyFile.RelativeDirectory, propertyFile.FileName); var templates = new Dictionary <string, string> { { Constants.EntityTypeCtorTemplate.ToLower(CultureInfo.InvariantCulture), ctorTemplateFile }, { Constants.EntityTypeImportTemplate.ToLower(CultureInfo.InvariantCulture), importTemplateFile }, { Constants.EntityTypePropertyTemplate.ToLower(CultureInfo.InvariantCulture), propertyTemplateFile }, }; return(templates); }
/// <summary> /// Compile entity type template. /// </summary> /// <param name="language">Language option.</param> /// <returns>Entity type template.</returns> protected virtual Func <object, string> CompileEntityTypeTemplate( LanguageOptions language = LanguageOptions.CSharp) { EntitiesTemplateFiles.TryGetValue(Constants.EntityTypeTemplate, out TemplateFileInfo classFile); var entityTemplateFile = FileService.RetrieveTemplateFileContents( classFile.RelativeDirectory, classFile.FileName); var entityTemplate = HandlebarsLib.Compile(entityTemplateFile); return(entityTemplate); }