Open Closed

Register Service in Blazor App #1879


User avatar
0

Hi,

I have modified the volo framework - Volo.Abp.LanguageManagement , to add a new Interface - ICustomLanguageTextAppService. When I try to run the Blazor App I get the following error when - "There is no registered service of type 'Volo.Abp.LanguageManagement.ICustomLanguageTextAppService'"

The ICustomLanguageTextAppService inherits from the Volo.Abp.LanguageManagement interface ILanguageTextAppService. I have also modified the LanguageTextAppService with additional methods, to implement the new Interface ICustomLanguageTextAppService.

The question I have is, when I create a custom Interface inside the Volo.Abp.LanguageManagement module , how do I properly register the Interface / servcie in my Blazor App? I had no problems when I registered the ILanguageTextAppService in the same app.

Thanks,

Jesse

  • ABP Framework version: latest
  • UI type: Blazor Server
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): No

2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi, you can try this:

    public interface ICustomLanguageTextAppService : ILanguageTextAppService
    {
     ....
    }
    
    [ExposeServices(typeof(ICustomLanguageTextAppService), typeof(ILanguageTextAppService))]
    public class CustomLanguageTextAppService : LanguageTextAppService, ICustomLanguageTextAppService
    {
     ....
    }
    
  • User Avatar
    0

    Thank you liangshiwei , this worked!

    Jesse

    Hi, you can try this:

    public interface ICustomLanguageTextAppService : ILanguageTextAppService 
    { 
     .... 
    } 
    
    [ExposeServices(typeof(ICustomLanguageTextAppService), typeof(ILanguageTextAppService))] 
    public class CustomLanguageTextAppService : LanguageTextAppService, ICustomLanguageTextAppService 
    { 
     .... 
    } 
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11