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

Raw SQL queries for unmapped types #29931

Merged
merged 42 commits into from
Jan 12, 2023
Merged

Raw SQL queries for unmapped types #29931

merged 42 commits into from
Jan 12, 2023

Conversation

ajcvickers
Copy link
Contributor

@ajcvickers ajcvickers commented Dec 26, 2022

Fixes #10753

Builds an ad-hoc entity type and uses it to query when SqlQuery is called for a type that does not have a type mapping.

Things to consider:

  • The entity type cannot have relationships
  • Properties are mapped by convention and mapping attributes are respected.
  • The entity types are keyless.

@ajcvickers ajcvickers requested review from AndriySvyryd and a team December 26, 2022 10:37
@AndriySvyryd
Copy link
Member

If we are going this route, then I think it would make sense to use the same conventions used by the model building. We could run ConfigureConventions, remove the key and relationship discovery conventions and ignore all the types already mapped.
This way the result would be more predictable, and the user has a way of influencing it.

@ajcvickers ajcvickers force-pushed the WhatIfWeDidThis1224 branch from 74bd92d to df94994 Compare January 9, 2023 14:14
@ajcvickers ajcvickers changed the title Proof of concept: ad-hoc entity types Raw SQL queries for unmapped types Jan 9, 2023
@ajcvickers ajcvickers marked this pull request as ready for review January 9, 2023 14:15
@ajcvickers
Copy link
Contributor Author

@dotnet/efteam This is now ready for review.

Fixes #10753

Builds an ad-hoc entity type and uses it to query when `SqlQuery` is called for a type that does not have a type mapping.

Things to consider:

- The entity type cannot have relationships
- Properties are mapped by convention and mapping attributes are respected.
- The entity types are keyless.
@ajcvickers
Copy link
Contributor Author

@AndriySvyryd Updated.

Fixes #10753

Builds an ad-hoc entity type and uses it to query when `SqlQuery` is called for a type that does not have a type mapping.

Things to consider:

- The entity type cannot have relationships
- Properties are mapped by convention and mapping attributes are respected.
- The entity types are keyless.
@ajcvickers ajcvickers merged commit 38e9767 into main Jan 12, 2023
@ajcvickers ajcvickers deleted the WhatIfWeDidThis1224 branch January 12, 2023 18:04
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 raw SQL queries without defining an entity type for the result
6 participants