Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 8dfbe2e

Browse files
authored
Merge pull request #252 from linq2db/master
Release 5.12.0
2 parents b2fc60d + 71b48f9 commit 8dfbe2e

File tree

16 files changed

+134
-24
lines changed

16 files changed

+134
-24
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ dotnet_diagnostic.IDE0079.severity = none # IDE0079: Remove unnecessary suppress
251251
dotnet_diagnostic.IDE0080.severity = none # IDE0080: Remove unnecessary suppression operator
252252
dotnet_diagnostic.IDE0081.severity = none # IDE0081: Remove ByVal
253253
dotnet_diagnostic.IDE0083.severity = none # IDE0083: Use pattern matching (not operator)
254+
dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure
254255
dotnet_diagnostic.IDE1006.severity = none # IDE1006: Naming rule violation
255256

256257
dotnet_diagnostic.CS1998.severity = error # CS1998: Async method lacks 'await' operators and will run synchronously

Build/linq2db.Default.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>5.11.0</Version>
3+
<Version>5.12.0</Version>
44

55
<Authors>Svyatoslav Danyliv, Igor Tkachev, Dmitry Lukashenko, Ilya Chudin</Authors>
66
<Product>Linq to DB</Product>

Build/linq2db.Tests.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="linq2db.Default.props" />
33

44
<PropertyGroup>
5-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
5+
<TargetFramework>net5.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

Directory.Packages.props

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<PackageVersion Include="NUnit" Version="3.13.3" />
66
<PackageVersion Include="FluentAssertions" Version="6.6.0" />
77

8-
<PackageVersion Include="linq2db" Version="4.0.1" />
9-
<PackageVersion Include="linq2db.Tools" Version="4.0.1" />
8+
<PackageVersion Include="linq2db" Version="4.2.0" />
9+
<PackageVersion Include="linq2db.Tools" Version="4.2.0" />
1010

1111
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
1212

@@ -20,5 +20,8 @@
2020
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.10" />
2121
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.17" />
2222
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.17" />
23+
24+
<PackageVersion Include="EntityFrameworkCore.FSharp" Version="5.0.3" />
25+
<PackageVersion Include="FSharp.Core" Version="6.0.5" />
2326
</ItemGroup>
2427
</Project>

NuGet/linq2db.EntityFrameworkCore.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<dependencies>
1717
<group targetFramework=".NETStandard2.1">
1818
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="5.0.17" />
19-
<dependency id="linq2db" version="4.0.1" />
19+
<dependency id="linq2db" version="4.2.0" />
2020
</group>
2121
</dependencies>
2222
</metadata>

Source/LinqToDB.EntityFrameworkCore/EFCoreMetadataReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ public override int GetHashCode()
524524
var objExpr = new SqlTransparentExpression(Expression.Constant(DefaultValue.GetValue(type), type), _mappingSource?.FindMapping(propInfo));
525525

526526
var newExpression = _dependencies.MemberTranslatorProvider.Translate(objExpr, propInfo, propInfo.GetMemberType(), _logger!);
527-
if (newExpression != null)
527+
if (newExpression != null && newExpression != objExpr)
528528
{
529529
var parametersArray = new Expression[] { objExpr };
530530
result = ConvertToExpressionAttribute(propInfo, newExpression, parametersArray);

Source/LinqToDB.EntityFrameworkCore/Internal/LinqToDBForEFQueryProvider.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Linq.Expressions;
66
using System.Reflection;
7+
using System.Runtime.CompilerServices;
78
using System.Threading;
89
using System.Threading.Tasks;
910

@@ -158,8 +159,17 @@ IEnumerator IEnumerable.GetEnumerator()
158159
/// <returns>Query result as <see cref="IAsyncEnumerable{T}"/>.</returns>
159160
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken)
160161
{
161-
return Task.Run(() => QueryProvider.ExecuteAsyncEnumerable<T>(Expression, cancellationToken),
162-
cancellationToken).Result.GetAsyncEnumerator(cancellationToken);
162+
async IAsyncEnumerable<T> EnumerateAsyncEnumerable([EnumeratorCancellation] CancellationToken ct)
163+
{
164+
var asyncEnumerable = await QueryProvider.ExecuteAsyncEnumerable<T>(Expression, ct)
165+
.ConfigureAwait(false);
166+
await foreach (var item in asyncEnumerable.WithCancellation(ct).ConfigureAwait(false))
167+
{
168+
yield return item;
169+
}
170+
}
171+
172+
return EnumerateAsyncEnumerable(cancellationToken).GetAsyncEnumerator(cancellationToken);
163173
}
164174

165175
/// <summary>

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsDataConnection.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ public LinqToDBForEFToolsDataConnection(
8585
[NotNull] IDataProvider dataProvider,
8686
[NotNull] DbTransaction transaction,
8787
IModel? model,
88-
Func<Expression, IDataContext, DbContext?, IModel?, Expression>? transformFunc
89-
) : base(dataProvider, transaction)
88+
Func<Expression, IDataContext, DbContext?, IModel?, Expression>? transformFunc)
89+
: base(dataProvider, transaction)
9090
{
9191
Context = context;
9292
_model = model;
@@ -243,9 +243,11 @@ object IEntityServiceInterceptor.EntityCreated(EntityCreatedEventData eventData,
243243
var assignExpr = Expression.Assign(variable, Expression.Convert(objParam, entityType.ClrType));
244244

245245
var key = entityType.GetKeys().FirstOrDefault();
246+
if (key == null)
247+
return null;
246248

247249
var arrayExpr = key.Properties.Where(p => p.PropertyInfo != null || p.FieldInfo != null).Select(p =>
248-
Expression.Convert(Expression.MakeMemberAccess(variable, p.PropertyInfo ?? (MemberInfo)p.FieldInfo),
250+
Expression.Convert(Expression.MakeMemberAccess(variable, p.PropertyInfo ?? (MemberInfo)p.FieldInfo!),
249251
typeof(object)))
250252
.ToArray();
251253

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,7 @@ public virtual EFConnectionInfo ExtractConnectionInfo(IDbContextOptions? options
10741074
/// <param name="logger">Logger instance.</param>
10751075
public virtual void LogConnectionTrace(TraceInfo info, ILogger logger)
10761076
{
1077+
#pragma warning disable CA1848 // Use the LoggerMessage delegates
10771078
var logLevel = info.TraceLevel switch
10781079
{
10791080
TraceLevel.Off => LogLevel.None,
@@ -1084,7 +1085,6 @@ public virtual void LogConnectionTrace(TraceInfo info, ILogger logger)
10841085
_ => LogLevel.Trace,
10851086
};
10861087

1087-
#pragma warning disable CA1848 // Use the LoggerMessage delegates
10881088
using var _ = logger.BeginScope("TraceInfoStep: {TraceInfoStep}, IsAsync: {IsAsync}", info.TraceInfoStep, info.IsAsync);
10891089

10901090
switch (info.TraceInfoStep)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="..\..\Build\linq2db.Tests.props" />
4+
5+
<PropertyGroup>
6+
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<Compile Include="Tests.fs" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\..\Source\LinqToDB.EntityFrameworkCore\linq2db.EntityFrameworkCore.csproj" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
16+
<PackageReference Include="EntityFrameworkCore.FSharp" />
17+
<PackageReference Include="FSharp.Core" />
18+
</ItemGroup>
19+
20+
</Project>

0 commit comments

Comments
 (0)