Ends in:
2 DAYS
16 HRS
52 MIN
39 SEC
Ends in:
2 D
16 H
52 M
39 S
Open Closed

Static C# API Proxies without project reference #3432


User avatar
0
dkaczor created

I have two ABP applications:

  1. Modular App (A)
  2. Single layer App (B)

They both expose APIs. I want app A to make a call to app B's endpoint. I've read that the best way to do it is to generate static proxies in app A because then I don't have to deal with HttpClient. I've followed the docs and successfully generated client proxies. The problem is that app A seems to need a reference to app B's .csproj - the proxy generation does not create a Dto or AppService in app A, it just adds using statement to B's namespace. Is there a way to keep these two apps completely separate i.e. without adding project references and keeping the communication just on the HTTP request level?


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The module must be referenced.

  • User Avatar
    0
    dkaczor created

    Well, that's disappointing. Could you please explain the reasons for such behavior?

    If I had two really complex application I would need to keep them in the same solution (or at least in the same repository) which might disrupt the development process. If I understood correctly - the communication still happens on HTTP requests level, Why would I need to couple these two applications then? It should work like with angular proxies - DTOs and services should be generated in the client app.

    Also, it would be useful if you provided an example of proper way to create HttpClient and make HTTP requests in ABP app.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    abp is modular, when you want to call the API of another project, you can only refer to its contract or http client module, which is a modular design.

    Also, it would be useful if you provided an example of proper way to create HttpClient and make HTTP requests in ABP app.

    The default module template already includes these APIs and examples.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35