Open Closed

ABP Entity Framework multiple entities join peformance issue #4793


User avatar
0
mithun created

We have large data in two entities - Department (600k) and DepartmentTypes (25K) and below application service method is causing performance issue. Any alternate entity supported approaches to resolve the performance issue?

Ours is a tiered application with Blazor Web Assembly as a UI framework with Entity Framework and SQL Server. • ABP Framework version: v5.3 • UI type: / Blazor Web Assembly • DB provider: EF Core • Tiered (MVC) : Yes • Identity Server Separated : yes

Reference code:

 public async Task<..> GetDepartmentsWithTypeAsync()
        {
            var Departments = await _DepartmentRepository.GetQueryableAsync();
            var DepartmentTypes = await _DepartmentTypeRepository.GetQueryableAsync();

            var query = from p in Departments
                        join pl in DepartmentTypes on p.Id equals pl.DepartmentId
                         into joinGroup
                        from jr in joinGroup.DefaultIfEmpty()
                        orderby p.Id
                        select new
                        {
                           ...                                  
                        };
            var DepartmentDto = (from result in query
                               select new Department()
                               {
                                 ...                                  
                               }).ToList();

            return DepartmentDto;
        }


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

    hi

    You can use AsNoTracking to improve performance.

    https://www.c-sharpcorner.com/UploadFile/ff2f08/entity-framework-and-asnotracking/

    Change the log level to see ef logs

            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Debug()
                .Enrich.FromLogContext()
                .WriteTo.Async(c => c.File("Logs/logs.txt"))
                .WriteTo.Async(c => c.Console())
                .CreateLogger();
    
  • User Avatar
    0
    mithun created

    Thanks, any altenate approaches for blazorise grid such as server side paging and filtering reference ABP framework implementation

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I don't know yet

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