Skip to content

Commit

Permalink
Merge pull request #250 from linq2db/version3
Browse files Browse the repository at this point in the history
Release 3.20.0
  • Loading branch information
sdanyliv authored Sep 6, 2022
2 parents 4c73ad0 + 4bbec7f commit 1ed14c5
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 20 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ dotnet_diagnostic.IDE0079.severity = none # IDE0079: Remove unnecessary suppress
dotnet_diagnostic.IDE0080.severity = none # IDE0080: Remove unnecessary suppression operator
dotnet_diagnostic.IDE0081.severity = none # IDE0081: Remove ByVal
dotnet_diagnostic.IDE0083.severity = none # IDE0083: Use pattern matching (not operator)
dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure
dotnet_diagnostic.IDE1006.severity = none # IDE1006: Naming rule violation

dotnet_diagnostic.CS1998.severity = error # CS1998: Async method lacks 'await' operators and will run synchronously
Expand Down
4 changes: 2 additions & 2 deletions Build/linq2db.Default.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project>
<PropertyGroup>
<Version>3.19.0</Version>
<Version>3.20.0</Version>

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

Expand Down
2 changes: 1 addition & 1 deletion NuGet/linq2db.EntityFrameworkCore.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="3.1.25" />
<dependency id="linq2db" version="4.0.1" />
<dependency id="linq2db" version="4.2.0" />
</group>
</dependencies>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ public override int GetHashCode()
var objExpr = new SqlTransparentExpression(Expression.Constant(DefaultValue.GetValue(type), type), _mappingSource?.FindMapping(propInfo));
var newExpression = _dependencies.MemberTranslatorProvider.Translate(objExpr, propInfo, propInfo.GetMemberType());
if (newExpression != null)
if (newExpression != null && newExpression != objExpr)
{
var parametersArray = new Expression[] { objExpr };
result = ConvertToExpressionAttribute(propInfo, newExpression, parametersArray);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -160,8 +161,17 @@ IEnumerator IEnumerable.GetEnumerator()
/// <returns>Query result as <see cref="IAsyncEnumerable{T}"/>.</returns>
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken)
{
return Task.Run(() => QueryProvider.ExecuteAsyncEnumerable<T>(Expression, cancellationToken),
cancellationToken).Result.GetAsyncEnumerator(cancellationToken);
async IAsyncEnumerable<T> EnumerateAsyncEnumerable([EnumeratorCancellation] CancellationToken ct)
{
var asyncEnumerable = await QueryProvider.ExecuteAsyncEnumerable<T>(Expression, ct)
.ConfigureAwait(false);
await foreach (var item in asyncEnumerable.WithCancellation(ct).ConfigureAwait(false))
{
yield return item;
}
}

return EnumerateAsyncEnumerable(cancellationToken).GetAsyncEnumerator(cancellationToken);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public LinqToDBForEFToolsDataConnection(
[NotNull] IDataProvider dataProvider,
[NotNull] DbTransaction transaction,
IModel? model,
Func<Expression, IDataContext, DbContext?, IModel?, Expression>? transformFunc
) : base(dataProvider, transaction)
Func<Expression, IDataContext, DbContext?, IModel?, Expression>? transformFunc)
: base(dataProvider, transaction)
{
Context = context;
_model = model;
Expand Down Expand Up @@ -140,7 +140,7 @@ public TypeKey(IEntityType entityType, IModel? model)
}

public IEntityType EntityType { get; }
public IModel? Model { get; }
public IModel? Model { get; }

protected bool Equals(TypeKey other)
{
Expand Down Expand Up @@ -187,7 +187,7 @@ object IEntityServiceInterceptor.EntityCreated(EntityCreatedEventData eventData,
return entity;

if (!LinqToDBForEFTools.EnableChangeTracker
|| !Tracking
|| !Tracking
|| Context!.ChangeTracker.QueryTrackingBehavior == QueryTrackingBehavior.NoTracking)
return entity;

Expand Down Expand Up @@ -243,9 +243,11 @@ object IEntityServiceInterceptor.EntityCreated(EntityCreatedEventData eventData,
var assignExpr = Expression.Assign(variable, Expression.Convert(objParam, entityType.ClrType));

var key = entityType.GetKeys().FirstOrDefault();
if (key == null)
return null;

var arrayExpr = key.Properties.Where(p => p.PropertyInfo != null || p.FieldInfo != null).Select(p =>
Expression.Convert(Expression.MakeMemberAccess(variable, p.PropertyInfo ?? (MemberInfo)p.FieldInfo),
Expression.Convert(Expression.MakeMemberAccess(variable, p.PropertyInfo ?? (MemberInfo)p.FieldInfo!),
typeof(object)))
.ToArray();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,7 @@ public virtual EFConnectionInfo ExtractConnectionInfo(IDbContextOptions? options
/// <param name="logger">Logger instance.</param>
public virtual void LogConnectionTrace(TraceInfo info, ILogger logger)
{
#pragma warning disable CA1848 // Use the LoggerMessage delegates
var logLevel = info.TraceLevel switch
{
TraceLevel.Off => LogLevel.None,
Expand All @@ -1072,7 +1073,6 @@ public virtual void LogConnectionTrace(TraceInfo info, ILogger logger)
_ => LogLevel.Trace,
};

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

switch (info.TraceInfoStep)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ namespace LinqToDB.EntityFrameworkCore.PostgreSQL.Tests.Models.NpgSqlEntities
public class EntityWithXmin
{
[Key]
public int Id { get; set; }

public uint xmin { get; set; }
public int Id { get; set; }
public uint xmin { get; set; }
public string Value { get; set; } = null!;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class EventScheduleItemBase
{
public int Id { get; set; }
public virtual LocalizedString NameLocalized { get; set; } = null!;
public virtual string JsonColumn { get; set; } = null!;
public virtual string? JsonColumn { get; set; }
}

public enum CrashEnum : byte
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
variables:
solution: 'linq2db.EFCore.sln'
build_configuration: 'Release'
assemblyVersion: 3.19.0
nugetVersion: 3.19.0
assemblyVersion: 3.20.0
nugetVersion: 3.20.0
artifact_nugets: 'nugets'

# build on commits to important branches (master + release branches):
Expand Down
7 changes: 5 additions & 2 deletions linq2db.EFCore.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29324.140
# Visual Studio Version 17
VisualStudioVersion = 17.2.32505.173
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "linq2db.EntityFrameworkCore", "Source\LinqToDB.EntityFrameworkCore\linq2db.EntityFrameworkCore.csproj", "{29F45BE9-3B57-4162-A02A-59F05528A0E7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{A3F30061-485E-4112-9675-3AE332BEED13}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
azure-pipelines.yml = azure-pipelines.yml
Directory.Packages.props = Directory.Packages.props
global.json = global.json
Build\linq2db.Default.props = Build\linq2db.Default.props
Build\linq2db.snk = Build\linq2db.snk
Build\linq2db.Tests.props = Build\linq2db.Tests.props
Expand Down

0 comments on commit 1ed14c5

Please sign in to comment.