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

Commit 33f389e

Browse files
authored
Merge pull request #222 from linq2db/master
Release 5.10.0
2 parents cab240d + d9d50d6 commit 33f389e

File tree

6 files changed

+48
-14
lines changed

6 files changed

+48
-14
lines changed

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.9.0</Version>
3+
<Version>5.10.0</Version>
44

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

Directory.Packages.props

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

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

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

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.12" />
19-
<dependency id="linq2db" version="3.5.2" />
19+
<dependency id="linq2db" version="3.7.0" />
2020
</group>
2121
</dependencies>
2222
</metadata>

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -767,12 +767,24 @@ public virtual Expression TransformExpression(Expression expression, IDataContex
767767
var tracking = true;
768768
var ignoreTracking = false;
769769

770+
var nonEvaluatableParameters = new HashSet<ParameterExpression>();
771+
770772
TransformInfo LocalTransform(Expression e)
771773
{
772774
e = CompactExpression(e);
773775

774776
switch (e.NodeType)
775777
{
778+
case ExpressionType.Lambda:
779+
{
780+
foreach (var parameter in ((LambdaExpression)e).Parameters)
781+
{
782+
nonEvaluatableParameters.Add(parameter);
783+
}
784+
785+
break;
786+
}
787+
776788
case ExpressionType.Constant:
777789
{
778790
if (dc != null && typeof(EntityQueryable<>).IsSameOrParentOf(e.Type) || typeof(DbSet<>).IsSameOrParentOf(e.Type))
@@ -905,14 +917,18 @@ TransformInfo LocalTransform(Expression e)
905917

906918
if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type))
907919
{
908-
// Invoking function to evaluate EF's Subquery located in function
909-
910-
var obj = EvaluateExpression(methodCall.Object);
911-
var arguments = methodCall.Arguments.Select(EvaluateExpression).ToArray();
912-
if (methodCall.Method.Invoke(obj, arguments) is IQueryable result)
920+
if (null == methodCall.Find(nonEvaluatableParameters,
921+
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t)))
913922
{
914-
if (!ExpressionEqualityComparer.Instance.Equals(methodCall, result.Expression))
915-
return new TransformInfo(result.Expression, false, true);
923+
// Invoking function to evaluate EF's Subquery located in function
924+
925+
var obj = EvaluateExpression(methodCall.Object);
926+
var arguments = methodCall.Arguments.Select(EvaluateExpression).ToArray();
927+
if (methodCall.Method.Invoke(obj, arguments) is IQueryable result)
928+
{
929+
if (!ExpressionEqualityComparer.Instance.Equals(methodCall, result.Expression))
930+
return new TransformInfo(result.Expression, false, true);
931+
}
916932
}
917933
}
918934

Tests/LinqToDB.EntityFrameworkCore.PostgreSQL.Tests/NpgSqlTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,23 @@ where Sql.Ext.PostgreSQL().Overlaps(m.Guids, guids)
8787
}
8888
}
8989

90+
[Test]
91+
public void TestUnnest()
92+
{
93+
using var db = CreateNpgSqlEntitiesContext();
94+
using var dc = db.CreateLinqToDbConnection();
95+
96+
var guids = new Guid[] { Guid.Parse("271425b1-ebe8-400d-b71d-a6e47a460ae3"),
97+
Guid.Parse("b75de94e-6d7b-4c70-bfa1-f8639a6a5b35") };
98+
99+
var query =
100+
from m in db.EntityWithArrays.ToLinqToDBTable()
101+
from g in dc.Unnest(m.Guids)
102+
where Sql.Ext.PostgreSQL().Overlaps(m.Guids, guids)
103+
select m;
104+
105+
query.Invoking(q => q.ToArray()).Should().NotThrow();
106+
}
107+
90108
}
91109
}

azure-pipelines.yml

Lines changed: 3 additions & 3 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: 5.9.0
5-
nugetVersion: 5.9.0
4+
assemblyVersion: 5.10.0
5+
nugetVersion: 5.10.0
66
artifact_nugets: 'nugets'
77

88
# build on commits to important branches (master + release branches):
@@ -25,7 +25,7 @@ stages:
2525
jobs:
2626
- job: build_job
2727
pool:
28-
vmImage: 'windows-2019'
28+
vmImage: 'windows-2022'
2929
variables:
3030
packageVersion: $(nugetVersion)
3131
displayName: 'Build'

0 commit comments

Comments
 (0)