-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
9.0 should set collection translation to use constants #1955
Comments
@kanadaj regardless of your issue, note that EF 10 will likely switch back to inlining constants for parameterized collections by default, since that generally produces better query plans (see dotnet/efcore#34347). But generally the same technical infrastructure is also relevant for collection columns (e.g. a column containing a JSON array of ints), so this is still relevant. |
Im getting this error Even though I have My setup: services.AddDbContext<TContext>(delegate (DbContextOptionsBuilder options)
{
options.UseMySql(MySqlContainerFixture.ConnectionString, new MySqlServerVersion("8.0.26"), options =>
{
options
.TranslateParameterizedCollectionsToConstants() // <-- uses EF.Constant() for all collections - Needed to enable "Primitive collections" https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1960
.EnableRetryOnFailure();
});
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
}); |
@benjaminoerskov If calling |
@lauxjpn Thanks for your reply. I was trying to access a list of guids, but my migration created it as a string. I think thats the reason I couldnt get it to work. I resolved it by moving my data to a new table instead. |
EF Core 9.0 supports Parameterized Collections, but Pomelo seems to throw on trying to translate it. It requires setting
TranslateParameterizedCollectionsToConstants()
in the options for any queries involving.Where(x => myCollection.Contains(x.Field))
to work at all. Might be best to set it by default to make upgrades smoother until it's fixed.Setting it by default in general might be best in order to preserve current behaviour so it's an opt-in with
TranslateParameterizedCollectionsToParameters()
insteadThe text was updated successfully, but these errors were encountered: