Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to configure dynamic API for multiple module #2063


User avatar
0
birthdaycensus created

Hello dears We are building a project that we want to have in modules. Like a module for 'blog', 'sales', 'accounting', ... Each of these modules will have their sets of models and expose some services to the clients How do I get the dynamic API generating to work for this multiple modules so that we can expose application service classes to the client from all the modules


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Please see this answer #1977@08c79bc2-4391-4b40-b9c0-4afe7ba3c124

    Basically you need to register all of your application module's services using the same approach.

  • User Avatar
    0
    birthdaycensus created

    Hello Dear Thanks for your response. I have already done what is suggested in that post. This is what I am having in the Initialize method of my WebApiModule

    Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder
                    .ForAll<IApplicationService>(typeof(KolaApplicationModule).Assembly, "app")
                    .Build();
    
                Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder
                    .ForAll<IApplicationService>(typeof(KolaContentApplicationModule).Assembly, "content")
                    .Build();
    

    In the KolaContentApplicationModule, I have ICategoryAppService that has a method GetCategory(int id) I am trying to access this method from the endpoint, /api/services/content/category/GetCategory?id=10 I got the error, "No HTTP resource was found that matches the request URI 'http://localhost:6634/api/services/content/category/GetCategory?id=10'." But when I move ICategoryAppService to the KolaApplicationModule, I can access it from /api/services/app/category/GetCategory?id=10

    Note that KolaContentApplicationModule is in a different project. In the Initialize method of the KolaContentApplicationModule , I have made the call,

    IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
    

    What am I doing wrong, please

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Does your WebApiModule depends on KolaContentApplicationModule ?