Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy Loading adds lazyLoader to json output #12772

Closed
ilushka85 opened this issue Jul 24, 2018 · 9 comments
Closed

Lazy Loading adds lazyLoader to json output #12772

ilushka85 opened this issue Jul 24, 2018 · 9 comments
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@ilushka85
Copy link

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

How can this be removed and not automatically added?

@ajcvickers
Copy link
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:

@ajcvickers ajcvickers added this to the 2.2.0 milestone Jul 30, 2018
@ajcvickers ajcvickers self-assigned this Jul 30, 2018
@ajcvickers ajcvickers modified the milestones: 2.2.0-preview2, 2.2.0 Sep 11, 2018
ajcvickers added a commit that referenced this issue Sep 17, 2018
Fixes #12772

Using `IgnoreDataMember` for this since it doesn't bring in any new dependencies and is honored by JSON.NET.
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Sep 17, 2018
ajcvickers added a commit that referenced this issue Sep 17, 2018
Fixes #12772

Using `IgnoreDataMember` for this since it doesn't bring in any new dependencies and is honored by JSON.NET.
ajcvickers added a commit that referenced this issue Sep 18, 2018
Fixes #12772

Using `IgnoreDataMember` for this since it doesn't bring in any new dependencies and is honored by JSON.NET.
ajcvickers added a commit that referenced this issue Sep 18, 2018
Fixes #12772

Using `IgnoreDataMember` for this since it doesn't bring in any new dependencies and is honored by JSON.NET.
@ajcvickers ajcvickers modified the milestones: 2.2.0-preview3, 2.2.0 Nov 11, 2019
@EdiWang
Copy link

EdiWang commented Jul 13, 2021

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

How to avoid this?

@EfimenkoAndrew
Copy link
Contributor

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

How to avoid this? @ajcvickers

@EfimenkoAndrew
Copy link
Contributor

#28084 pls review

@EdiWang
Copy link

EdiWang commented Apr 26, 2023

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

@ajcvickers
Copy link
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.

@EdiWang
Copy link

EdiWang commented Mar 1, 2024

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!

@ajcvickers
Copy link
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.

@EdiWang
Copy link

EdiWang commented Mar 3, 2024

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.

@ajcvickers ajcvickers removed their assignment Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

No branches or pull requests

4 participants