Open Closed

Dynamically Configuring IsEnabledForGetRequests in AuditLog - Blazor #8508


User avatar
0
thanhlg created
  • ABP Framework version: v8.3.0
  • UI Type: Blazor Web App
  • Database System: EF Core (PostgreSQL)

Hi,

I am configuring IsEnabledForGetRequests of AuditLog as false, and I want to add it to the interface so that it can be dynamically changed instead of being hardcoded in the code. How can I do this? Could you provide a code example

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
    liangshiwei created
    Fullstack Developer

    Hi,

    According to the document, it is a singleton, and you can directly modify it. https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-9.0#options-interfaces

    public class TestAppService : TestappAppService
    {
        private readonly IOptions<AbpAuditingOptions> _options;
    
        public TestAppService(IOptions<AbpAuditingOptions> options)
        {
            _options = options;
        }
    
        public void ChangeOptions()
        {
            _options.Value.IsEnabledForGetRequests = !_options.Value.IsEnabledForGetRequests;
        }
        
        public bool GetIsEnabledForGetRequests()
        {
            return _options.Value.IsEnabledForGetRequests;
        }
    }
    
    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.