Open Closed

How we can extend Dynamic API Client Proxy to allow changing RemoteService base url dynamically ? #3224


User avatar
0
krashhh created

Hi,

I want to use Dynamic API Client Proxy, but I need an option to change the base URL in runtime before specific service API call.

public class MyService : ITransientDependency
{
    private readonly IHttpClientProxy<IBookAppService> _bookService;

    public MyService(IHttpClientProxy<IBookAppService> bookHttpClientProxy)
    {
        _bookHttpClientProxy = bookHttpClientProxy;
    }

    public async Task DoIt()
    {
       ** _bookHttpClientProxy.BaseURL = "xyz";     // Something like this.**
        var books = await _bookHttpClientProxy.Service.GetListAsync();
        foreach (var book in books)
        {
            Console.WriteLine($"[BOOK {book.Id}] Name={book.Name}");
        }
    }
}

Please help me how I can extend something to achieve this functionality?

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

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

    hi

    You can change the AbpRemoteServiceOptions. And use AddAbpDynamicOptions<AbpRemoteServiceOptions>

    https://github.com/abpframework/abp/pull/6332

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.