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

Commit 1ed14c5

Browse files
authored
Merge pull request #250 from linq2db/version3
Release 3.20.0
2 parents 4c73ad0 + 4bbec7f commit 1ed14c5

File tree

11 files changed

+35
-20
lines changed

11 files changed

+35
-20
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>3.19.0</Version>
3+
<Version>3.20.0</Version>
44

55
<Authors>Svyatoslav Danyliv, Igor Tkachev, Dmitry Lukashenko, Ilya Chudin</Authors>
66
<Product>Linq to DB</Product>
77
<Company>linq2db.net</Company>
8-
<Copyright>2002-2021 linq2db.net</Copyright>
8+
<Copyright>2002-2022 linq2db.net</Copyright>
99
<RepositoryUrl>https://github.com/linq2db/linq2db.EntityFrameworkCore</RepositoryUrl>
1010
<RepositoryType>git</RepositoryType>
1111

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.0">
1818
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="3.1.25" />
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
@@ -511,7 +511,7 @@ public override int GetHashCode()
511511
var objExpr = new SqlTransparentExpression(Expression.Constant(DefaultValue.GetValue(type), type), _mappingSource?.FindMapping(propInfo));
512512

513513
var newExpression = _dependencies.MemberTranslatorProvider.Translate(objExpr, propInfo, propInfo.GetMemberType());
514-
if (newExpression != null)
514+
if (newExpression != null && newExpression != objExpr)
515515
{
516516
var parametersArray = new Expression[] { objExpr };
517517
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

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

167177
/// <summary>

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsDataConnection.cs

Lines changed: 7 additions & 5 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;
@@ -140,7 +140,7 @@ public TypeKey(IEntityType entityType, IModel? model)
140140
}
141141

142142
public IEntityType EntityType { get; }
143-
public IModel? Model { get; }
143+
public IModel? Model { get; }
144144

145145
protected bool Equals(TypeKey other)
146146
{
@@ -187,7 +187,7 @@ object IEntityServiceInterceptor.EntityCreated(EntityCreatedEventData eventData,
187187
return entity;
188188

189189
if (!LinqToDBForEFTools.EnableChangeTracker
190-
|| !Tracking
190+
|| !Tracking
191191
|| Context!.ChangeTracker.QueryTrackingBehavior == QueryTrackingBehavior.NoTracking)
192192
return entity;
193193

@@ -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
@@ -1062,6 +1062,7 @@ public virtual EFConnectionInfo ExtractConnectionInfo(IDbContextOptions? options
10621062
/// <param name="logger">Logger instance.</param>
10631063
public virtual void LogConnectionTrace(TraceInfo info, ILogger logger)
10641064
{
1065+
#pragma warning disable CA1848 // Use the LoggerMessage delegates
10651066
var logLevel = info.TraceLevel switch
10661067
{
10671068
TraceLevel.Off => LogLevel.None,
@@ -1072,7 +1073,6 @@ public virtual void LogConnectionTrace(TraceInfo info, ILogger logger)
10721073
_ => LogLevel.Trace,
10731074
};
10741075

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

10781078
switch (info.TraceInfoStep)

Tests/LinqToDB.EntityFrameworkCore.PostgreSQL.Tests/Models/NpgSqlEntities/EntityWithXmin.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ namespace LinqToDB.EntityFrameworkCore.PostgreSQL.Tests.Models.NpgSqlEntities
66
public class EntityWithXmin
77
{
88
[Key]
9-
public int Id { get; set; }
10-
11-
public uint xmin { get; set; }
9+
public int Id { get; set; }
10+
public uint xmin { get; set; }
1211
public string Value { get; set; } = null!;
1312
}
1413
}

Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/JsonConverTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class EventScheduleItemBase
2727
{
2828
public int Id { get; set; }
2929
public virtual LocalizedString NameLocalized { get; set; } = null!;
30-
public virtual string JsonColumn { get; set; } = null!;
30+
public virtual string? JsonColumn { get; set; }
3131
}
3232

3333
public enum CrashEnum : byte

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
variables:
22
solution: 'linq2db.EFCore.sln'
33
build_configuration: 'Release'
4-
assemblyVersion: 3.19.0
5-
nugetVersion: 3.19.0
4+
assemblyVersion: 3.20.0
5+
nugetVersion: 3.20.0
66
artifact_nugets: 'nugets'
77

88
# build on commits to important branches (master + release branches):

0 commit comments

Comments
 (0)