-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Cosmos: Projecting out owned entities retrieves the entire document #34067
Labels
area-cosmos
area-perf
area-query
consider-for-next-release
punted-for-9.0
Originally planned for the EF Core 9.0 (EF9) release, but moved out due to resource constraints.
type-bug
Milestone
Comments
roji
changed the title
Cosmos: Projecting out owned entities retrieves the entire document
Cosmos: Projecting out owned entities which own additional entity types retrieves the entire document
Jun 22, 2024
ajcvickers
added
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
punted-for-9.0
Originally planned for the EF Core 9.0 (EF9) release, but moved out due to resource constraints.
and removed
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
labels
Jul 30, 2024
Not actually closed by #34355 |
@roji This is not limited to owned entities that have additional types. Projecting either an owned reference or collection results in bringing back the entire document. For example: await context
.Set<Customer>()
.AsNoTracking()
.Select(e => e.Addresses)
.ToListAsync();
await context
.Set<Customer>()
.AsNoTracking()
.Select(e => e.PhoneNumber)
.ToListAsync();
public class Customer
{
public Guid Id { get; set; }
public required string Name { get; set; }
public required string PrimaryCountry { get; set; }
public required string Region { get; set; }
public List<string>? Notes { get; set; }
public Phone PhoneNumber { get; set; }
public List<Address> Addresses { get; } = new();
}
public class Address
{
public required string Street { get; set; }
public required string City { get; set; }
public required string Postcode { get; set; }
public required string Country { get; set; }
}
public class Phone
{
public required int CountryCode { get; set; }
public required string Number { get; set; }
} |
@ajcvickers understood and thanks for checking... I think this makes this even more important to fix (in 10). |
roji
changed the title
Cosmos: Projecting out owned entities which own additional entity types retrieves the entire document
Cosmos: Projecting out owned entities retrieves the entire document
Aug 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-cosmos
area-perf
area-query
consider-for-next-release
punted-for-9.0
Originally planned for the EF Core 9.0 (EF9) release, but moved out due to resource constraints.
type-bug
Since PersonAddress owns further entity types (OwnedCountry), the expression inside the Select() contains IncludeExpression; this leads CosmosProjectionBindingExpressionVisitor into a specific path where we end up projecting the entire document. Compare how this works in relational - CosmosProjectionBindingExpressionVisitor is one place where Cosmos is still quite behind.
The text was updated successfully, but these errors were encountered: