Open Closed

How to create new text template #1669


User avatar
-1
viswajwalith created
  • ABP Framework version: v4.4.0
  • UI type: MVC
  • DB provider: EF Core / MongoDB
  • **Micro service template

We gone through the link and tried to define new text template https://docs.abp.io/en/abp/latest/Text-Templating#defining-templates

we are unable to trigger TemplateDefinitionProvider, aded to web application while running the application.


42 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    It will triggered when you're using the template fuctions.

  • User Avatar
    0
    viswajwalith created

    Thank you, It is triggering when we using the template. How to add this template to text templates module, show in Grid and edit its content.

  • User Avatar
    0
    maliming created
    Support Team

    hi

    You can define the Razor or Scriban template. Then it will show in this list.

    https://docs.abp.io/en/abp/latest/Text-Templating-Razor https://docs.abp.io/en/abp/latest/Text-Templating-Scriban

  • User Avatar
    0
    viswajwalith created

    https://docs.abp.io/en/abp/latest/Text-Templating-Razor

    We followed the link and created the hello template but it is not showing in list.

  • User Avatar
    0
    maliming created
    Support Team

    hi

    https://zoom.us/j/92718384520?pwd=ZE5sYnZIQmlzTUdrbXF0dHFmWUpNZz09

    Can i check it?

  • User Avatar
    0
    viswajwalith created

    hi

    I am ready to join now

  • User Avatar
    0
    maliming created
    Support Team

    https://zoom.us/j/95166594146?pwd=bU0yVitydnBhZGMxTlJURzJsMEl3UT09

  • User Avatar
    0
    maliming created
    Support Team

    There are some problems with ZOOM.

    Can you create a new project and try your code then share it with me? liming.ma@volosoft.com

  • User Avatar
    0
    viswajwalith created

    can we try again in zoom

  • User Avatar
    0
    viswajwalith created

    can we try again in zoom

  • User Avatar
    0
    maliming created
    Support Team

    I can't control your computer in ZOOM.

  • User Avatar
    0
    viswajwalith created

    we will try once again

  • User Avatar
    0
    maliming created
    Support Team

    https://zoom.us/j/95270082795?pwd=OHhoYXJoUUgzTTFQTWI1M3BhM1Uydz09

  • User Avatar
    0
    maliming created
    Support Team

    https://support.abp.io/QA/Questions/1669#answer-c03a1acf-3901-fd26-f527-39fe2ce102ce

  • User Avatar
    0
    viswajwalith created

    We created new project and tried but facing same issue. How to share project with your email, project compressed size is 183MB

  • User Avatar
    0
    maliming created
    Support Team

    You can run the delete-bin-obj-folders.bat and compress project, liming.ma@volosoft.com

  • User Avatar
    0
    viswajwalith created

    project sent to liming.ma@volosoft.com

  • User Avatar
    0
    maliming created
    Support Team

    hi

    Please add your code to TextTemplateDemo.HttpApi.Host project instead TextTemplateDemo.Web

  • User Avatar
    0
    viswajwalith created

    Code added to TextTemplateDemo.HttpApi.Host

    Now templates showing in text templates module list, but not able to render Hello template. we are able to render StandardEmailTemplates.Message template.

    When we were added code to TextTemplateDemo.Web, we were able to render template but not displaying in the texttemplate list.

  • User Avatar
    0
    maliming created
    Support Team

    but not able to render Hello template

    You can't do this in TextTemplateDemo.Web project.

    It only available in TextTemplateDemo.HttpApi.Host project.

  • User Avatar
    0
    viswajwalith created

    We can render StandardEmailTemplates.Message template in TextTemplateDemo.Web

    how to render hello templates in TextTemplateDemo.Web like StandardEmailTemplates.Message template.

  • User Avatar
    0
    maliming created
    Support Team

    HI

    The TextTemplateDemo.Web is a UI project, It should not contains business logic. eg render hello templates

    You can render template in application. then call it in TextTemplateDemo.Web project.

  • User Avatar
    0
    viswajwalith created

    Hi,

    We are using micro service template for our application and we have multiple micro services.

    We want to develope custom text templates for all the microservices.

    For normal application we can implement text templates in TextTemplateDemo.HttpApi.Host project, but in micro service where do we implement text templates at one place for all micro services.

    Our micro service application structure:

  • User Avatar
    0
    maliming created
    Support Team

    hi

    Maybe you can try to add it in AdministrationService.

    AdministrationService is an infrastructural microservice

    https://docs.abp.io/en/commercial/latest/startup-templates/microservice/microservices#administrationservice

  • User Avatar
    0
    viswajwalith created

    Hi,

    We created a new text template in AdministrationService and we are able to see the template in text template list.

    To access the template we created app service and controller in Administration service and we are able see the API in Swagger but not able to use it from web and not found in ServiceProxyScript

  • User Avatar
    0
    maliming created
    Support Team

    Have you tried removing RemoteService attribute?

  • User Avatar
    0
    viswajwalith created

    Yes, after removing RemoteService also same issue.

  • User Avatar
    0
    maliming created
    Support Team

    hi

    Can you share the content of /Abp/ServiceProxyScript endpoint with me? liming.ma@volosoft.com

  • User Avatar
    0
    viswajwalith created

    hi

    Can you share the content of /Abp/ServiceProxyScript endpoint with me? liming.ma@volosoft.com

    Responded over Email ....

  • User Avatar
    0
    viswajwalith created

    Files shared over Email as discussed.

  • User Avatar
    0
    maliming created
    Support Team

    hi viswajwalith

    It works for me.

    Yes, after removing RemoteService also same issue.

    Maybe you can re-confirm this.

  • User Avatar
    0
    viswajwalith created

    hi viswajwalith

    It works for me.

    Yes, after removing RemoteService also same issue.

    Maybe you can re-confirm this.

    Can you please share the updated files back to us for verification

  • User Avatar
    0
    maliming created
    Support Team

    hi

    I sent an email.

  • User Avatar
    0
    viswajwalith created

    hi

    I sent an email.

    no access to download, I replaied please accescpt the access request

  • User Avatar
    0
    maliming created
    Support Team

    I have set the permission to access .

  • User Avatar
    0
    viswajwalith created

    Hi,

    It got succeded after adding the web project in AdministrationSrvice and DownstreamPathTemplate/UpstreamPathTemplate in gateways appsettings.json

    We are facing the iisue when we consuming the text template.

    System.Exception: CreateAssembly failed
    Build failed
    (7,126): error CS0234: The type or namespace name 'EmailTemplates' does not exist in the namespace 'Exceego.EHSWatch.AppV3.AdministrationService' (are you missing an assembly reference?)
    
    
       at Volo.Abp.TextTemplating.Razor.AbpRazorTemplateCSharpCompiler.CreateAssembly(String code, String assemblyName, List`1 references, CSharpCompilationOptions options)
       at Volo.Abp.TextTemplating.Razor.DefaultAbpCompiledViewProvider.GetAssemblyStreamAsync(TemplateDefinition templateDefinition, String templateContent)
       at Volo.Abp.TextTemplating.Razor.DefaultAbpCompiledViewProvider.<>c__DisplayClass6_0.<<GetAssemblyAsync>g__CreateAssembly|0>d.MoveNext()
    --- End of stack trace from previous location ---
       at Volo.Abp.TextTemplating.Razor.DefaultAbpCompiledViewProvider.GetAssemblyAsync(TemplateDefinition templateDefinition)
       at Volo.Abp.TextTemplating.Razor.RazorTemplateRenderingEngine.RenderTemplateContentWithRazorAsync(TemplateDefinition templateDefinition, String body, Dictionary`2 globalContext, Object model)
       at Volo.Abp.TextTemplating.Razor.RazorTemplateRenderingEngine.RenderSingleTemplateAsync(TemplateDefinition templateDefinition, String body, Dictionary`2 globalContext, Object model)
       at Volo.Abp.TextTemplating.Razor.RazorTemplateRenderingEngine.RenderInternalAsync(String templateName, String body, Dictionary`2 globalContext, Object model)
       at Volo.Abp.TextTemplating.Razor.RazorTemplateRenderingEngine.RenderAsync(String templateName, Object model, String cultureName, Dictionary`2 globalContext)
       at Volo.Abp.TextTemplating.AbpTemplateRenderer.RenderAsync(String templateName, Object model, String cultureName, Dictionary`2 globalContext)
    
  • User Avatar
    0
    maliming created
    Support Team

    hi

    Please share the full Exception error stack.

  • User Avatar
    0
    viswajwalith created

    Hi,

    full Exception error stack shared over email.

  • User Avatar
    0
    maliming created
    Support Team

    hi

    You can try to move the TemplateDefinition related code to Exceego.EHSWatch.AppV3.AdministrationService.Application

  • User Avatar
    0
    viswajwalith created

    Hi,

    after moving the TextTemplateDefinitionProvider to Applications also same error.

    can we connect remotely and solve it.

  • User Avatar
    0
    maliming created
    Support Team

    You can add Applicationand Applications.Contract modules.

  • User Avatar
    0
    viswajwalith created

    Hi,

    Thank you for your support.

    The solution provided worked for us. Thanks once again for your continuous support.

Made with ❤️ on ABP v8.0.0 Updated on September 27, 2023, 12:25