Hi Abp Support Team, How can I retrieve more than 1000 records with MaxResultCount and... I added ScreenUrl to AuditLogs like this: I want to add ScreenUrl and CurrentUser.Id to EntityChanges. How can I do that? Is there any way to retrieve multiple EntityIds on the same page? For example, I have a Customer page. The page has one EntityId of the Customer table, which I have set as DocId in the code. Inside the page, I have a grid that stores data for the CustomerABC table, which will have another EntityId. I have added ScreenUrl to AuditLogs to retrieve the information of the page where the changes were made, but when there are more than 1000 records, retrieving the data is not accurate. I have switched to filtering EntityIds based on the DocId of the currently opened page to narrow down the data. However, using this approach, if the page contains child tables with different entities, I cannot retrieve the data of those tables. Could you provide an example of how to handle this request? Thanks,
- ABP Framework version: v7.4.1
- UI Type: Blazor WASM
- Database System: EF Core (PostgreSQL)
- Check before asking a question:
14 Answer(s)
-
0
Hi,
Sorry, I don't quite understand your question.
Could you explain it more clearly? Thank you.
-
0
Hi, I apologize for the complexity of my question. I want to add ScreenUrl and UserId to ExtraProperties of EntityChanges (currently only possible to store in the ExtraProperties of AuditLogs), and I would like to be able to retrieve more than 1000 records because the current MaxResultCount limit is 1000.
-
0
I want to add ScreenUrl and UserId to ExtraProperties of EntityChanges
For example:
public class MyAuditLogContributor : AuditLogContributor { public override void PostContribute(AuditLogContributionContext context) { foreach (var change in context.AuditInfo.EntityChanges) { change.SetProperty() } } }
and I would like to be able to retrieve more than 1000 records because the current MaxResultCount limit is 1000.
You can try:
public override void ConfigureServices(ServiceConfigurationContext context) { ExtensibleLimitedResultRequestDto.MaxMaxResultCount = int.MaxValue; }
-
0
Thank you very much.
Could you please clarify if it is possible to filter data when retrieving a list of EntityChanges using ExtraProperties? I would like to retrieve a list of data where ScreenUrl in ExtraProperties is equal to the URL of the currently opened page. Additionally, I need to filter multiple EntityIds within the same page. How can this be achieved? Could you provide me with some suggestions?
-
0
-
0
Hi,
Sorry, will it work if you try this?
public override void ConfigureServices(ServiceConfigurationContext context) { LimitedResultRequestDto.MaxMaxResultCount = int.MaxValue; ExtensibleLimitedResultRequestDto.MaxMaxResultCount = int.MaxValue; }
-
0
Could you please clarify if it is possible to filter data when retrieving a list of EntityChanges using ExtraProperties
No, it will not work.
You need to override the service.
First: https://docs.abp.io/en/abp/latest/Entity-Framework-Core#mapefcoreproperty Then, you can filter data via shadow-properties : https://learn.microsoft.com/en-us/ef/core/modeling/shadow-properties#accessing-shadow-properties
-
0
public override void ConfigureServices(ServiceConfigurationContext context) { LimitedResultRequestDto.MaxMaxResultCount = int.MaxValue; ExtensibleLimitedResultRequestDto.MaxMaxResultCount = int.MaxValue; }
Thanks for the support, but if I don't use this configuration, can you help me rewrite the 'GetEntityChanges' method without using pagination and without limiting the number of results?
-
0
Hi,
Sure.
[ExposeServices(typeof(IAuditLogsAppService))] public class MyAuditLogsAppService : AuditLogsAppService { public MyAuditLogsAppService(IAuditLogRepository auditLogRepository, IJsonSerializer jsonSerializer, IPermissionChecker permissionChecker, IPermissionDefinitionManager permissionDefinitionManager) : base(auditLogRepository, jsonSerializer, permissionChecker, permissionDefinitionManager) { } }
-
0
[ExposeServices(typeof(IAuditLogsAppService))] public class MyAuditLogsAppService : AuditLogsAppService { public MyAuditLogsAppService(IAuditLogRepository auditLogRepository, IJsonSerializer jsonSerializer, IPermissionChecker permissionChecker, IPermissionDefinitionManager permissionDefinitionManager) : base(auditLogRepository, jsonSerializer, permissionChecker, permissionDefinitionManager) { } }
Can you help me write the GetEntityChangesAsync(GetEntityChangesDto input) method without being limited by MaxResultCount?
-
0
Hi,
I have shown how to replace the
AuditLogsAppService
service, you can override any method you want : )For example:
[ExposeServices(typeof(IAuditLogsAppService))] public class MyAuditLogsAppService : AuditLogsAppService { public MyAuditLogsAppService(IAuditLogRepository auditLogRepository, IJsonSerializer jsonSerializer, IPermissionChecker permissionChecker, IPermissionDefinitionManager permissionDefinitionManager) : base(auditLogRepository, jsonSerializer, permissionChecker, permissionDefinitionManager) { } public override Task<PagedResultDto<EntityChangeDto>> GetEntityChangesAsync(GetEntityChangesDto input) { input.MaxResultCount = int.MaxValue; return base.GetEntityChangesAsync(input); } }
-
0
What if the data exceeds int.MaxValue?
-
0
https://learn.microsoft.com/en-us/dotnet/api/system.int32.maxvalue?view=net-8.0
Int.MaxValue is
2147483647
. I don't know why you have to return so much data. You may need to reconsider your use cases. : ) -
-1
if used for multiple years, the data will inevitably become very large. Is there a better alternative?
No, as I said, you should rethink your use cases. you can consider using data range to filter data.