Skip to content

Lazy Loading adds lazyLoader to json output #12772

Closed

Description

@ilushka85

When using lazy loading and data is returned by webapi the property lazyLoader is added.

How can this be removed and not automatically added?

Activity

  1. ajcvickers commented on Jul 30, 2018

    @ajcvickers
    Contributor

    @ilushka85 The property is needed for the lazy-loading infrastructure used by proxies. However, we will add an attribute to the property in the future to prevent it being serialized. For now, this answer on Stack Overflow shows how it can be ignored from your code.

    Useful links for implementer:

  2. added this to the milestone on Jul 30, 2018
  3. self-assigned this
    on Jul 30, 2018
  4. modified the milestones: , on Sep 11, 2018
  5. added a commit that references this issue on Sep 17, 2018
    e425653
  6. added 3 commits that reference this issue on Sep 17, 2018
    5615707
    10ca6ce
    8e41270
  7. modified the milestones: , 2.2.0 on Nov 11, 2019
  8. EdiWang commented on Jul 13, 2021

    @EdiWang

    return Ok(entity) in ASP.NET 5 Web API will still produce "lazyLoader": {}

    How to avoid this?

  9. EfimenkoAndrew commented on May 23, 2022

    @EfimenkoAndrew
    Contributor

    return Ok(entity) in ASP.NET Core 6 Web API will still produce "lazyLoader": {}

    How to avoid this? @ajcvickers

  10. EfimenkoAndrew commented on May 23, 2022

    @EfimenkoAndrew
    Contributor

    #28084 pls review

  11. EdiWang commented on Apr 26, 2023

    @EdiWang

    This is still happening with EFCore 7.0 using System.Text.Json

    I do see the fix by #28084 is there in the latest package.

    image

    However, it's not working, I am returning Entity that mapped to a SQL Server View, not Table. Does this fix includes View?

    image

  12. ajcvickers commented on May 1, 2023

    @ajcvickers
    Contributor

    @ilushka85 I am not able to reproduce this. Please open a new issue and attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.

  13. EdiWang commented on Mar 1, 2024

    @EdiWang

    This is still happening with EFCore 7.0 using System.Text.Json

    I do see the fix by #28084 is there in the latest package.

    image

    However, it's not working, I am returning Entity that mapped to a SQL Server View, not Table. Does this fix includes View?

    image

    Almost a year has passed, the problem is still there with .NET 8.0, EF Core 8.0.

    It happens to SQL Server View, not Table! View not Table!! View, not Table!!!

    Could anyone apply the fix to View also, not Table!

  14. ajcvickers commented on Mar 1, 2024

    @ajcvickers
    Contributor

    @EdiWang I am not able to reproduce this. Please open a new issue and attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.

  15. EdiWang commented on Mar 3, 2024

    @EdiWang

    Hi @ajcvickers Thanks for the quick reply. I've created #33223 and attached a minimal runnable project. I'm able to reproduce the problem without a SQL Server View. It happens to Table also.

  16. removed their assignment
    on Sep 1, 2024
  17. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions