I have an unknown amount of parameters for my inclause. How can I write it so it works with EF Core?
var formattedValues = String.Join(",", values.Select(s => "'" + s + "'"));
var identifierParam = new SqlParameter("jsonColumn", $"$.{identifierKey}");
var filterValueParam = new SqlParameter("value", $"%{formattedValues}%");
var items = dbContext.Items.FromSql("select * FROM Items WHERE AND JSON_VALUE(Attributes, @jsonColumn) in (@value)", filterValueParam, identifierParam).ToList();
I think it is because each value in the in clause needs it's own Parameter.