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

Simple scalar group by does not work #20328

Closed
TehWardy opened this issue Mar 18, 2020 · 1 comment
Closed

Simple scalar group by does not work #20328

TehWardy opened this issue Mar 18, 2020 · 1 comment

Comments

@TehWardy
Copy link

Having been advised to upgrade from v2 because of it's end of life I notice that basically grouping is broken, the current advice appears to be to generate a ticket for grouping scenario, I couldn't find one for this scenario so here it is ...

var results = Db.Set<T>().GroupBy(i => i.ScalarValue).ToArray();

... this results in the well known issue that others reporting grouping problems are facing.
Solving this by the looks of things will fix at least 5 or 6 OData related tickets too.

Typical example from my web stack, I have an entity that looks like this ...

[Table("Resources", Schema = "CMS")]
public class Resource
{
    [Key]
    public int Id { get; set; }

    [ForeignKey("App")]
    public int AppId { get; set; }

    [Required]
    public string Key { get; set; }

    [Required(AllowEmptyStrings = true)]
    public string Culture { get; set; }

    [Required]
    public string Name { get; set; }

    [Required]
    public string DisplayName { get; set; }

    [Required]
    public string ShortDisplayName { get; set; }

    [Required]
    public string Description { get; set; }

    public virtual App App { get; set; }
}

Running this query on EF Core 3.1 breaks, but works find on EF Core 2 ...

var resources = Db.Set<Resource>()
   .Where(r => r.AppId = 1).GroupBy(r => r.Key)
   .ToArray();
@smitpatel
Copy link
Contributor

duplicate of #19929

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants