Skip to content

Commit d8705fc

Browse files
committed
Rename JsonExists to JsonPathExists
Part of #31136
1 parent 9db9403 commit d8705fc

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

src/EFCore.Relational/Extensions/RelationalDbFunctionsExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ public static T Greatest<T>(this DbFunctions _, [NotParameterized] params T[] va
5656
/// <param name="_">The <see cref="DbFunctions" /> instance.</param>
5757
/// <param name="json">The JSON value to check.</param>
5858
/// <param name="path">The JSON path to look for.</param>
59-
public static bool JsonExists(this DbFunctions _, object json, string path)
60-
=> throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(JsonExists)));
59+
public static bool JsonPathExists(this DbFunctions _, object json, string path)
60+
=> throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(JsonPathExists)));
6161
}

src/EFCore.SqlServer/Query/Internal/SqlServerSqlTranslatingExpressionVisitor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
240240
_typeMappingSource.FindMapping(isUnicode ? "nvarchar(max)" : "varchar(max)"));
241241
}
242242

243-
// We translate EF.Functions.JsonExists here and not in a method translator since we need to support JsonExists over
243+
// We translate EF.Functions.JsonPathExists here and not in a method translator since we need to support JsonPathExists over
244244
// complex and owned JSON properties, which requires special handling.
245-
case nameof(RelationalDbFunctionsExtensions.JsonExists)
245+
case nameof(RelationalDbFunctionsExtensions.JsonPathExists)
246246
when declaringType == typeof(RelationalDbFunctionsExtensions)
247247
&& @object is null
248248
&& arguments is [_, var json, var path]:

src/EFCore.Sqlite.Core/Query/Internal/SqliteSqlTranslatingExpressionVisitor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ when methodCallExpression.Object is not null
236236
method.Name is nameof(string.StartsWith));
237237
}
238238

239-
// We translate EF.Functions.JsonExists here and not in a method translator since we need to support JsonExists over
239+
// We translate EF.Functions.JsonPathExists here and not in a method translator since we need to support JsonPathExists over
240240
// complex and owned JSON properties, which requires special handling.
241-
case nameof(RelationalDbFunctionsExtensions.JsonExists)
241+
case nameof(RelationalDbFunctionsExtensions.JsonPathExists)
242242
when declaringType == typeof(RelationalDbFunctionsExtensions)
243243
&& @object is null
244244
&& arguments is [_, var json, var path]:

test/EFCore.Relational.Specification.Tests/Query/Translations/JsonTranslationsRelationalTestBase.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@
66

77
namespace Microsoft.EntityFrameworkCore.Query.Translations;
88

9-
// This test suite covers translations of JSON functions on EF.Functions (e.g. EF.Functions.JsonExists).
9+
// This test suite covers translations of JSON functions on EF.Functions (e.g. EF.Functions.JsonPathExists).
1010
// It does not cover general, built-in JSON support via complex type mapping, etc.
1111
public abstract class JsonTranslationsRelationalTestBase<TFixture>(TFixture fixture) : QueryTestBase<TFixture>(fixture)
1212
where TFixture : JsonTranslationsRelationalTestBase<TFixture>.JsonTranslationsQueryFixtureBase, new()
1313
{
1414
[ConditionalFact]
15-
public virtual Task JsonExists_on_scalar_string_column()
15+
public virtual Task JsonPathExists_on_scalar_string_column()
1616
=> AssertQuery(
1717
ss => ss.Set<JsonTranslationsEntity>()
18-
.Where(b => EF.Functions.JsonExists(b.JsonString, "$.OptionalInt")),
18+
.Where(b => EF.Functions.JsonPathExists(b.JsonString, "$.OptionalInt")),
1919
ss => ss.Set<JsonTranslationsEntity>()
2020
.Where(b => ((IDictionary<string, JsonNode>)JsonNode.Parse(b.JsonString)!).ContainsKey("OptionalInt")));
2121

2222
[ConditionalFact]
23-
public virtual Task JsonExists_on_complex_property()
23+
public virtual Task JsonPathExists_on_complex_property()
2424
=> AssertQuery(
2525
ss => ss.Set<JsonTranslationsEntity>()
26-
.Where(b => EF.Functions.JsonExists(b.JsonComplexType, "$.OptionalInt")),
26+
.Where(b => EF.Functions.JsonPathExists(b.JsonComplexType, "$.OptionalInt")),
2727
ss => ss.Set<JsonTranslationsEntity>()
2828
.Where(b => ((IDictionary<string, JsonNode>)JsonNode.Parse(b.JsonString)!).ContainsKey("OptionalInt")));
2929

3030
[ConditionalFact]
31-
public virtual Task JsonExists_on_owned_entity()
31+
public virtual Task JsonPathExists_on_owned_entity()
3232
=> AssertQuery(
3333
ss => ss.Set<JsonTranslationsEntity>()
34-
.Where(b => EF.Functions.JsonExists(b.JsonOwnedType, "$.OptionalInt")),
34+
.Where(b => EF.Functions.JsonPathExists(b.JsonOwnedType, "$.OptionalInt")),
3535
ss => ss.Set<JsonTranslationsEntity>()
3636
.Where(b => ((IDictionary<string, JsonNode>)JsonNode.Parse(b.JsonString)!).ContainsKey("OptionalInt")));
3737

test/EFCore.SqlServer.FunctionalTests/Query/Translations/JsonTranslationsSqlServerTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ public JsonTranslationsSqlServerTest(JsonTranslationsQuerySqlServerFixture fixtu
1313
}
1414

1515
[ConditionalFact, SqlServerCondition(SqlServerCondition.SupportsFunctions2022)]
16-
public override async Task JsonExists_on_scalar_string_column()
16+
public override async Task JsonPathExists_on_scalar_string_column()
1717
{
18-
await base.JsonExists_on_scalar_string_column();
18+
await base.JsonPathExists_on_scalar_string_column();
1919

2020
AssertSql(
2121
"""
@@ -26,9 +26,9 @@ WHERE JSON_PATH_EXISTS([j].[JsonString], N'$.OptionalInt') = 1
2626
}
2727

2828
[ConditionalFact, SqlServerCondition(SqlServerCondition.SupportsFunctions2022)]
29-
public override async Task JsonExists_on_complex_property()
29+
public override async Task JsonPathExists_on_complex_property()
3030
{
31-
await base.JsonExists_on_complex_property();
31+
await base.JsonPathExists_on_complex_property();
3232

3333
AssertSql(
3434
"""
@@ -39,9 +39,9 @@ WHERE JSON_PATH_EXISTS([j].[JsonComplexType], N'$.OptionalInt') = 1
3939
}
4040

4141
[ConditionalFact, SqlServerCondition(SqlServerCondition.SupportsFunctions2022)]
42-
public override async Task JsonExists_on_owned_entity()
42+
public override async Task JsonPathExists_on_owned_entity()
4343
{
44-
await base.JsonExists_on_owned_entity();
44+
await base.JsonPathExists_on_owned_entity();
4545

4646
AssertSql(
4747
"""

test/EFCore.Sqlite.FunctionalTests/Query/Translations/JsonTranslationsSqliteTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ public JsonTranslationsSqliteTest(JsonTranslationsQuerySqliteFixture fixture, IT
1313
}
1414

1515
[ConditionalFact]
16-
public override async Task JsonExists_on_scalar_string_column()
16+
public override async Task JsonPathExists_on_scalar_string_column()
1717
{
18-
await base.JsonExists_on_scalar_string_column();
18+
await base.JsonPathExists_on_scalar_string_column();
1919

2020
AssertSql(
2121
"""
@@ -26,9 +26,9 @@ WHERE json_type("j"."JsonString", '$.OptionalInt') IS NOT NULL
2626
}
2727

2828
[ConditionalFact]
29-
public override async Task JsonExists_on_complex_property()
29+
public override async Task JsonPathExists_on_complex_property()
3030
{
31-
await base.JsonExists_on_complex_property();
31+
await base.JsonPathExists_on_complex_property();
3232

3333
AssertSql(
3434
"""
@@ -39,9 +39,9 @@ WHERE json_type("j"."JsonComplexType", '$.OptionalInt') IS NOT NULL
3939
}
4040

4141
[ConditionalFact]
42-
public override async Task JsonExists_on_owned_entity()
42+
public override async Task JsonPathExists_on_owned_entity()
4343
{
44-
await base.JsonExists_on_owned_entity();
44+
await base.JsonPathExists_on_owned_entity();
4545

4646
AssertSql(
4747
"""

0 commit comments

Comments
 (0)