Base solution for your next web application
Open Closed

How to show the very large data on the UI Grid #936


User avatar
0
sampath created

Hi, This is actually not related to the asp.netzero. But hope you can give a better solution for me with your vast experience.

public List<PropertyListDto> GetPropertiesByStatus(GetPropertyInput input)
        {
     
            //exception occurs here
            var properties = _propertyRepository
                .GetAll()
                .Include(p => p.Address)
                .ToList();

            var results = new List<PropertyListDto>(properties.OrderBy(p => p.Id).MapTo<List<PropertyListDto>>());
           return results;
            
        }
[AutoMapFrom(typeof(Property))]
    public class PropertyListDto : FullAuditedEntityDto
    {
        public new int Id { get; set; }
        public CountyListDto County { get; set; }
        public string Priority { get; set; }
        public string Dist { get; set; }
        public decimal ListingPrice { get; set; }
        public string Blk { get; set; }
        public AddressDto Address { get; set; }
        public string Contact { get; set; }
        public string Lot { get; set; }
        public decimal Taxes { get; set; }
        public string Mls { get; set; }
        public ICollection<CommentEditDto> Comments { get; set; }
        public int? LegacyId { get; set; }
    }

Q : I need to show around 100,000 (1 lakh) data on the Angular UI Grid.But the problem is, above query gives memory exception.So could you tell me how to sort out this issue ? Thanks.

Note : I need to show the data without pagination.So I have selected this UI Grid.

[http://ui-grid.info/docs/#/tutorial/404_large_data_sets_and_performance])


2 Answer(s)
  • User Avatar
    0
    sampath created

    When I use .AsNoTracking(), then it works fine on the first query.

    var properties = _propertyRepository
                    .GetAll()
                    .AsNoTracking()
                    .Include(p => p.Address)
                    .ToList();
    

    But then the problem is on MapTo line.Could you tell me how to sort it out ? Thanks.

    var results = new List<PropertyListDto>(properties.OrderBy(p => p.Id).MapTo<List<PropertyListDto>>());
    

    This is the error :

    {"Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."}
    
    Mapping types:
    Property_A048C3D093990BB6A086B710BAC90CB35FD4BAB180FC02FA3E90053FE58F20D3 -> ICollection`1
    System.Data.Entity.DynamicProxies.Property_A048C3D093990BB6A086B710BAC90CB35FD4BAB180FC02FA3E90053FE58F20D3 -> System.Collections.Generic.ICollection`1[[IP.Comments.Dtos.CommentEditDto,IP.Application, Version=1.7.1.1, Culture=neutral, PublicKeyToken=null]]
    
    Destination path:
    List`1[3126].Comments3126[3126].Comments3126[3126]
    
    Source value:
    [Property_A048C3D093990BB6A086B710BAC90CB35FD4BAB180FC02FA3E90053FE58F20D3 3166]
    
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    I haven't seen timeout eror for automapper before. It's very strange. Probably, it's not related to automapper. Can you share the stacktrace? Also, you can try to increase UOW timeout. Add this property to your app service method:

    [UnitOfWork(timeout: 360000)]