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

Collection parameter translation fails with nontrivial expressions #413

Closed
bachratyg opened this issue Sep 30, 2024 · 1 comment
Closed

Comments

@bachratyg
Copy link

See marked row below

Repro:

using Microsoft.EntityFrameworkCore;

var codes = new string[] { "a", "b", "c" };

using var db = new AppDb();
var q = from s in db.Stuffs
		where codes.Any(c => c.StartsWith(s.Code))  // <--- this causes the problem
		select s;

Console.WriteLine(q.ToQueryString());

class AppDb : DbContext
{
	public DbSet<Stuff> Stuffs => this.Set<Stuff>();
	protected override void OnConfiguring(DbContextOptionsBuilder builder)
		=> builder.UseOracle("Data Source=whatever");
}
class Stuff
{
	public int Id { get; set; }
	public required string Code { get; set; }
}

Exception thrown:

System.InvalidOperationException: 'Query root of type 'ParameterQueryRootExpression' wasn't handled by provider code. This issue happens when using a provider specific method on a different provider where it is not supported.'

This works in MSSQL via json arrays (i.e. OPENJSON) and could have a semantically equivalent translation via JSON_TABLE (should be supported in 19+)

If the indicated line is quasi-trivial e.g. codes.Contains(s.Code) or codes.Any(c => c == s.Code) then translation succeeds.

Versions:

  • Oracle.EntityFrameworkCore 8.23.50
  • Oracle.ManagedDataAccess.Core 23.5.1
@alexkeh
Copy link
Member

alexkeh commented Oct 9, 2024

This feature requires primitive collections, which is request #347. Thus, I've marked this as a duplicate request.

@alexkeh alexkeh closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
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

2 participants