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
1 Answer(s)
-
0
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; } }