Skip to content

Commit 6f77314

Browse files
committed
Review comments
1 parent 3100638 commit 6f77314

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

Diff for: src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2822,7 +2822,7 @@ protected virtual ValuesExpression ApplyTypeMappingsOnValuesExpression(ValuesExp
28222822
for (var i = 0; i < newRowValues.Length; i++)
28232823
{
28242824
var rowValue = valuesExpression.RowValues[i];
2825-
var newValues = new SqlExpression[valuesExpression.ColumnNames.Count - (stripOrdering ? 1 : 0)];
2825+
var newValues = new SqlExpression[newColumnNames.Count];
28262826
for (var j = 0; j < valuesExpression.ColumnNames.Count; j++)
28272827
{
28282828
Check.DebugAssert(rowValue.Values[j] is SqlConstantExpression, "Non-constant SqlExpression in ValuesExpression");

Diff for: src/EFCore.SqlServer/Infrastructure/SqlServerDbContextOptionsBuilder.cs

-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ public virtual SqlServerDbContextOptionsBuilder EnableRetryOnFailure(
114114
/// documentation on compatibility level</see> for more information and examples.
115115
/// </remarks>
116116
/// <param name="compatibilityLevel"><see langword="false" /> to have null resource</param>
117-
// TODO: Naming; Cosmos doesn't have Use/Set, so just CompatibilityLevel? SetCompatibilityLevel?
118117
public virtual SqlServerDbContextOptionsBuilder UseCompatibilityLevel(int compatibilityLevel)
119118
=> WithOption(e => e.WithCompatibilityLevel(compatibilityLevel));
120119
}

Diff for: test/EFCore.Relational.Specification.Tests/Query/NonSharedPrimitiveCollectionsQueryRelationalTestBase.cs

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public virtual async Task Column_collection_inside_json_owned_entity()
2727

2828
var result = await context.Set<TestOwner>().SingleAsync(o => o.Owned.Strings.Count() == 2);
2929
Assert.Equivalent(new[] { "foo", "bar" }, result.Owned.Strings);
30+
31+
result = await context.Set<TestOwner>().SingleAsync(o => o.Owned.Strings[1] == "bar");
32+
Assert.Equivalent(new[] { "foo", "bar" }, result.Owned.Strings);
3033
}
3134

3235
protected class TestOwner

Diff for: test/EFCore.SqlServer.FunctionalTests/Query/NonSharedPrimitiveCollectionsQuerySqlServerTest.cs

+10
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,16 @@ FROM [TestOwner] AS [t]
265265
WHERE (
266266
SELECT COUNT(*)
267267
FROM OpenJson(JSON_VALUE([t].[Owned], '$.Strings')) AS [s]) = 2
268+
""",
269+
//
270+
"""
271+
SELECT TOP(2) [t].[Id], [t].[Owned]
272+
FROM [TestOwner] AS [t]
273+
WHERE (
274+
SELECT [s].[value]
275+
FROM OpenJson(JSON_VALUE([t].[Owned], '$.Strings')) AS [s]
276+
ORDER BY CAST([s].[key] AS int)
277+
OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY) = N'bar'
268278
""");
269279
}
270280

Diff for: test/EFCore.Sqlite.FunctionalTests/Query/NonSharedPrimitiveCollectionsQuerySqliteTest.cs

+11
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,17 @@ public override async Task Column_collection_inside_json_owned_entity()
224224
FROM "TestOwner" AS "t"
225225
WHERE json_array_length(json_extract("t"."Owned", '$.Strings')) = 2
226226
LIMIT 2
227+
""",
228+
//
229+
"""
230+
SELECT "t"."Id", "t"."Owned"
231+
FROM "TestOwner" AS "t"
232+
WHERE (
233+
SELECT "s"."value"
234+
FROM json_each(json_extract("t"."Owned", '$.Strings')) AS "s"
235+
ORDER BY "s"."key"
236+
LIMIT 1 OFFSET 1) = 'bar'
237+
LIMIT 2
227238
""");
228239
}
229240

0 commit comments

Comments
 (0)