Skip to content

Commit 24efb9c

Browse files
author
msftbot[bot]
authored
Merge pull request #31575 from dotnet-maestro-bot/merge/release/8.0-to-main
[automated] Merge branch 'release/8.0' => 'main'
2 parents a566a5b + 00f0630 commit 24efb9c

File tree

5 files changed

+125
-41
lines changed

5 files changed

+125
-41
lines changed

eng/Version.Details.xml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
33
<ProductDependencies>
4-
<Dependency Name="Microsoft.Extensions.Caching.Memory" Version="8.0.0-rc.1.23421.3">
4+
<Dependency Name="Microsoft.Extensions.Caching.Memory" Version="8.0.0-rc.2.23426.4">
55
<Uri>https://github.com/dotnet/runtime</Uri>
6-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
6+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
77
</Dependency>
8-
<Dependency Name="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0-rc.1.23421.3">
8+
<Dependency Name="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0-rc.2.23426.4">
99
<Uri>https://github.com/dotnet/runtime</Uri>
10-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
10+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
1111
</Dependency>
12-
<Dependency Name="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0-rc.1.23421.3">
12+
<Dependency Name="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0-rc.2.23426.4">
1313
<Uri>https://github.com/dotnet/runtime</Uri>
14-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
14+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
1515
</Dependency>
16-
<Dependency Name="Microsoft.Extensions.Configuration.Json" Version="8.0.0-rc.1.23421.3">
16+
<Dependency Name="Microsoft.Extensions.Configuration.Json" Version="8.0.0-rc.2.23426.4">
1717
<Uri>https://github.com/dotnet/runtime</Uri>
18-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
18+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
1919
</Dependency>
20-
<Dependency Name="Microsoft.Extensions.Configuration" Version="8.0.0-rc.1.23421.3">
20+
<Dependency Name="Microsoft.Extensions.Configuration" Version="8.0.0-rc.2.23426.4">
2121
<Uri>https://github.com/dotnet/runtime</Uri>
22-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
22+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
2323
</Dependency>
24-
<Dependency Name="Microsoft.Extensions.DependencyInjection" Version="8.0.0-rc.1.23421.3">
24+
<Dependency Name="Microsoft.Extensions.DependencyInjection" Version="8.0.0-rc.2.23426.4">
2525
<Uri>https://github.com/dotnet/runtime</Uri>
26-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
26+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
2727
</Dependency>
28-
<Dependency Name="Microsoft.Extensions.DependencyModel" Version="8.0.0-rc.1.23421.3">
28+
<Dependency Name="Microsoft.Extensions.DependencyModel" Version="8.0.0-rc.2.23426.4">
2929
<Uri>https://github.com/dotnet/runtime</Uri>
30-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
30+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
3131
</Dependency>
32-
<Dependency Name="Microsoft.Extensions.HostFactoryResolver.Sources" Version="8.0.0-rc.1.23421.3">
32+
<Dependency Name="Microsoft.Extensions.HostFactoryResolver.Sources" Version="8.0.0-rc.2.23426.4">
3333
<Uri>https://github.com/dotnet/runtime</Uri>
34-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
34+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
3535
</Dependency>
36-
<Dependency Name="Microsoft.Extensions.Logging" Version="8.0.0-rc.1.23421.3">
36+
<Dependency Name="Microsoft.Extensions.Logging" Version="8.0.0-rc.2.23426.4">
3737
<Uri>https://github.com/dotnet/runtime</Uri>
38-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
38+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
3939
</Dependency>
40-
<Dependency Name="System.Text.Json" Version="8.0.0-rc.1.23421.3">
40+
<Dependency Name="System.Text.Json" Version="8.0.0-rc.2.23426.4">
4141
<Uri>https://github.com/dotnet/runtime</Uri>
42-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
42+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
4343
</Dependency>
44-
<Dependency Name="Microsoft.NETCore.App.Ref" Version="8.0.0-rc.1.23421.3">
44+
<Dependency Name="Microsoft.NETCore.App.Ref" Version="8.0.0-rc.2.23426.4">
4545
<Uri>https://github.com/dotnet/runtime</Uri>
46-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
46+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
4747
</Dependency>
48-
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="8.0.0-rc.1.23421.3">
48+
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="8.0.0-rc.2.23426.4">
4949
<Uri>https://github.com/dotnet/runtime</Uri>
50-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
50+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
5151
</Dependency>
5252
<!-- NB: Using BrowserDebugHost to represent the nonshipping version of Microsoft.NETCore.App -->
53-
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="8.0.0-rc.1.23421.3">
53+
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="8.0.0-rc.2.23426.4">
5454
<Uri>https://github.com/dotnet/runtime</Uri>
55-
<Sha>f8c110b8003d68cc635add4ca791d6cf2e645561</Sha>
55+
<Sha>4122c63a13cfe40e97ac1f9ef01d8110a66943f4</Sha>
5656
</Dependency>
5757
</ProductDependencies>
5858
<ToolsetDependencies>

eng/Versions.props

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
<UsingToolXliff>False</UsingToolXliff>
1717
</PropertyGroup>
1818
<PropertyGroup Label="Dependencies from dotnet/runtime">
19-
<MicrosoftExtensionsCachingMemoryVersion>8.0.0-rc.1.23421.3</MicrosoftExtensionsCachingMemoryVersion>
20-
<MicrosoftExtensionsConfigurationVersion>8.0.0-rc.1.23421.3</MicrosoftExtensionsConfigurationVersion>
21-
<MicrosoftExtensionsConfigurationAbstractionsVersion>8.0.0-rc.1.23421.3</MicrosoftExtensionsConfigurationAbstractionsVersion>
22-
<MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>8.0.0-rc.1.23421.3</MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>
23-
<MicrosoftExtensionsConfigurationJsonVersion>8.0.0-rc.1.23421.3</MicrosoftExtensionsConfigurationJsonVersion>
24-
<MicrosoftExtensionsDependencyInjectionVersion>8.0.0-rc.1.23421.3</MicrosoftExtensionsDependencyInjectionVersion>
25-
<MicrosoftExtensionsDependencyModelVersion>8.0.0-rc.1.23421.3</MicrosoftExtensionsDependencyModelVersion>
26-
<MicrosoftExtensionsHostFactoryResolverSourcesVersion>8.0.0-rc.1.23421.3</MicrosoftExtensionsHostFactoryResolverSourcesVersion>
27-
<MicrosoftExtensionsLoggingVersion>8.0.0-rc.1.23421.3</MicrosoftExtensionsLoggingVersion>
28-
<SystemTextJsonVersion>8.0.0-rc.1.23421.3</SystemTextJsonVersion>
29-
<MicrosoftNETCoreAppRefVersion>8.0.0-rc.1.23421.3</MicrosoftNETCoreAppRefVersion>
30-
<MicrosoftNETCoreAppRuntimewinx64Version>8.0.0-rc.1.23421.3</MicrosoftNETCoreAppRuntimewinx64Version>
31-
<MicrosoftNETCoreBrowserDebugHostTransportVersion>8.0.0-rc.1.23421.3</MicrosoftNETCoreBrowserDebugHostTransportVersion>
19+
<MicrosoftExtensionsCachingMemoryVersion>8.0.0-rc.2.23426.4</MicrosoftExtensionsCachingMemoryVersion>
20+
<MicrosoftExtensionsConfigurationVersion>8.0.0-rc.2.23426.4</MicrosoftExtensionsConfigurationVersion>
21+
<MicrosoftExtensionsConfigurationAbstractionsVersion>8.0.0-rc.2.23426.4</MicrosoftExtensionsConfigurationAbstractionsVersion>
22+
<MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>8.0.0-rc.2.23426.4</MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>
23+
<MicrosoftExtensionsConfigurationJsonVersion>8.0.0-rc.2.23426.4</MicrosoftExtensionsConfigurationJsonVersion>
24+
<MicrosoftExtensionsDependencyInjectionVersion>8.0.0-rc.2.23426.4</MicrosoftExtensionsDependencyInjectionVersion>
25+
<MicrosoftExtensionsDependencyModelVersion>8.0.0-rc.2.23426.4</MicrosoftExtensionsDependencyModelVersion>
26+
<MicrosoftExtensionsHostFactoryResolverSourcesVersion>8.0.0-rc.2.23426.4</MicrosoftExtensionsHostFactoryResolverSourcesVersion>
27+
<MicrosoftExtensionsLoggingVersion>8.0.0-rc.2.23426.4</MicrosoftExtensionsLoggingVersion>
28+
<SystemTextJsonVersion>8.0.0-rc.2.23426.4</SystemTextJsonVersion>
29+
<MicrosoftNETCoreAppRefVersion>8.0.0-rc.2.23426.4</MicrosoftNETCoreAppRefVersion>
30+
<MicrosoftNETCoreAppRuntimewinx64Version>8.0.0-rc.2.23426.4</MicrosoftNETCoreAppRuntimewinx64Version>
31+
<MicrosoftNETCoreBrowserDebugHostTransportVersion>8.0.0-rc.2.23426.4</MicrosoftNETCoreBrowserDebugHostTransportVersion>
3232
</PropertyGroup>
3333
<PropertyGroup Label="Dependencies from dotnet/arcade">
3434
<MicrosoftDotNetBuildTasksTemplatingVersion>8.0.0-beta.23425.2</MicrosoftDotNetBuildTasksTemplatingVersion>

src/EFCore.Sqlite.Core/Extensions/SqliteDbFunctionsExtensions.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,33 @@ public static bool Glob(this DbFunctions _, string matchExpression, string patte
4343
public static string Hex(this DbFunctions _, byte[] bytes)
4444
=> throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(Hex)));
4545

46+
/// <summary>
47+
/// Maps to the SQLite <c>unhex</c> function which returns a BLOB representing decoding of the hexadecimal string.
48+
/// </summary>
49+
/// <remarks>
50+
/// See <see href="https://aka.ms/efcore-docs-database-functions">Database functions</see>, and
51+
/// <see href="https://aka.ms/efcore-docs-sqlite">Accessing SQLite databases with EF Core</see> for more information and examples.
52+
/// </remarks>
53+
/// <param name="_">The <see cref="DbFunctions" /> instance.</param>
54+
/// <param name="value">The hexadecimal string.</param>
55+
/// <returns>Decoded hexadecimal string as binary value.</returns>
56+
public static byte[] Unhex(this DbFunctions _, string value)
57+
=> throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(Unhex)));
58+
59+
/// <summary>
60+
/// Maps to the SQLite <c>unhex</c> function which returns a BLOB representing decoding of the hexadecimal string.
61+
/// </summary>
62+
/// <remarks>
63+
/// See <see href="https://aka.ms/efcore-docs-database-functions">Database functions</see>, and
64+
/// <see href="https://aka.ms/efcore-docs-sqlite">Accessing SQLite databases with EF Core</see> for more information and examples.
65+
/// </remarks>
66+
/// <param name="_">The <see cref="DbFunctions" /> instance.</param>
67+
/// <param name="value">The hexadecimal string.</param>
68+
/// <param name="ignoreChars">Characters that are ignored in <paramref name="value"/>.</param>
69+
/// <returns>Decoded hexadecimal string as binary value.</returns>
70+
public static byte[] Unhex(this DbFunctions _, string value, string ignoreChars)
71+
=> throw new InvalidOperationException(CoreStrings.FunctionOnClient(nameof(Unhex)));
72+
4673
/// <summary>
4774
/// Maps to the SQLite <c>substr</c> function which returns a subarray of the specified value. The subarray starts
4875
/// at <paramref name="startIndex" /> and continues to the end of the value.

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ namespace Microsoft.EntityFrameworkCore.Sqlite.Query.Internal;
1313
/// </summary>
1414
public class SqliteHexMethodTranslator : IMethodCallTranslator
1515
{
16-
private static readonly MethodInfo MethodInfo = typeof(SqliteDbFunctionsExtensions)
16+
private static readonly MethodInfo HexMethodInfo = typeof(SqliteDbFunctionsExtensions)
1717
.GetMethod(nameof(SqliteDbFunctionsExtensions.Hex), new[] { typeof(DbFunctions), typeof(byte[]) })!;
1818

19+
private static readonly MethodInfo UnhexMethodInfo = typeof(SqliteDbFunctionsExtensions)
20+
.GetMethod(nameof(SqliteDbFunctionsExtensions.Unhex), new[] { typeof(DbFunctions), typeof(string) })!;
21+
22+
private static readonly MethodInfo UnhexWithIgnoreCharsMethodInfo = typeof(SqliteDbFunctionsExtensions)
23+
.GetMethod(nameof(SqliteDbFunctionsExtensions.Unhex), new[] { typeof(DbFunctions), typeof(string), typeof(string) })!;
24+
1925
private readonly ISqlExpressionFactory _sqlExpressionFactory;
2026

2127
/// <summary>
@@ -41,7 +47,7 @@ public SqliteHexMethodTranslator(ISqlExpressionFactory sqlExpressionFactory)
4147
IReadOnlyList<SqlExpression> arguments,
4248
IDiagnosticsLogger<DbLoggerCategory.Query> logger)
4349
{
44-
if (method.Equals(MethodInfo))
50+
if (method.Equals(HexMethodInfo))
4551
{
4652
return _sqlExpressionFactory.Function(
4753
"hex",
@@ -51,6 +57,17 @@ public SqliteHexMethodTranslator(ISqlExpressionFactory sqlExpressionFactory)
5157
typeof(string));
5258
}
5359

60+
if (method.Equals(UnhexMethodInfo)
61+
|| method.Equals(UnhexWithIgnoreCharsMethodInfo))
62+
{
63+
return _sqlExpressionFactory.Function(
64+
"unhex",
65+
arguments.Skip(1),
66+
nullable: true,
67+
arguments.Skip(1).Select(_ => true).ToArray(),
68+
typeof(byte[]));
69+
}
70+
5471
return null;
5572
}
5673
}

test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,46 @@ SELECT hex("o"."Bytes")
15461546
Assert.Equal(expectedResults, results);
15471547
}
15481548

1549+
[ConditionalFact]
1550+
public virtual void Can_query_using_unhex_function()
1551+
{
1552+
using var context = CreateContext();
1553+
1554+
var results = context.Set<ObjectBackedDataTypes>()
1555+
.Select(e => EF.Functions.Unhex(EF.Functions.Hex(e.Bytes))).ToList();
1556+
1557+
AssertSql(
1558+
"""
1559+
SELECT unhex(hex("o"."Bytes"))
1560+
FROM "ObjectBackedDataTypes" AS "o"
1561+
""");
1562+
1563+
var expectedResults = context.Set<ObjectBackedDataTypes>().AsEnumerable()
1564+
.Select(e => e.Bytes).ToList();
1565+
1566+
Assert.Equal(expectedResults, results);
1567+
}
1568+
1569+
[ConditionalFact]
1570+
public virtual void Can_query_using_unhex_function_with_ignore_chars()
1571+
{
1572+
using var context = CreateContext();
1573+
1574+
var results = context.Set<ObjectBackedDataTypes>()
1575+
.Select(e => EF.Functions.Unhex(EF.Functions.Hex(e.Bytes) + "!?", "!?")).ToList();
1576+
1577+
AssertSql(
1578+
"""
1579+
SELECT unhex(COALESCE(hex("o"."Bytes"), '') || '!?', '!?')
1580+
FROM "ObjectBackedDataTypes" AS "o"
1581+
""");
1582+
1583+
var expectedResults = context.Set<ObjectBackedDataTypes>().AsEnumerable()
1584+
.Select(e => e.Bytes).ToList();
1585+
1586+
Assert.Equal(expectedResults, results);
1587+
}
1588+
15491589
[ConditionalFact]
15501590
public virtual void Can_query_using_substr_function()
15511591
{

0 commit comments

Comments
 (0)