KEMBAR78
Allow service properties typed as object by ajcvickers · Pull Request #29919 · dotnet/efcore · GitHub
Skip to content

Conversation

@ajcvickers
Copy link
Contributor

Fixes #10042

Service properties have two uses:

  1. Allow the entity to use the service directly
  2. Allow EF to store state on the entity

This change allows 2 to happen without the entity needing to take a dependency on the service type. This allows the lazy-loader to store loaded state in the entity.

@ajcvickers ajcvickers requested a review from a team December 22, 2022 19:38
Copy link
Member

@AndriySvyryd AndriySvyryd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need to add support to CSharpRuntimeModelCodeGenerator and a test to CSharpRuntimeModelCodeGeneratorTest

Fixes #10042

Service properties have two uses:

1. Allow the entity to use the service directly
2. Allow EF to store state on the entity

This change allows 2 to happen without the entity needing to take a dependency on the service type. This allows the lazy-loader to store loaded state in the entity.
@ajcvickers ajcvickers merged commit b7e11eb into main Dec 23, 2022
@ajcvickers ajcvickers deleted the TotallyLoaded1221 branch December 23, 2022 22:04
@ashortland-eqix
Copy link

I can't seem to get this working with ILazyLoader, looks like it's trapping because there's a shadow property and it's detached

@ajcvickers
Copy link
Contributor Author

@ashortland-eqix 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support lazy and explicit loading from entities queried with NoTracking behavior

3 participants