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

Commit c21b399

Browse files
authored
Merge pull request #219 from linq2db/version3
Release 3.18.0
2 parents 08d71c5 + 2c64d3e commit c21b399

File tree

7 files changed

+55
-17
lines changed

7 files changed

+55
-17
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>3.17.0</Version>
3+
<Version>3.18.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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
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
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
1313

1414

15-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.21" />
16-
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.21" />
15+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.6" />
16+
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.6" />
1717

1818
<PackageVersion Include="Microsoft.Extensions.Logging" Version="5.0.0" />
1919
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />

NuGet/linq2db.EntityFrameworkCore.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<license type="file">MIT-LICENSE.txt</license>
1616
<dependencies>
1717
<group targetFramework=".NETStandard2.0">
18-
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="3.1.21" />
19-
<dependency id="linq2db" version="3.5.2" />
18+
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="3.1.6" />
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
@@ -772,12 +772,24 @@ public virtual Expression TransformExpression(Expression expression, IDataContex
772772
var tracking = true;
773773
var ignoreTracking = false;
774774

775+
var nonEvaluatableParameters = new HashSet<ParameterExpression>();
776+
775777
TransformInfo LocalTransform(Expression e)
776778
{
777779
e = CompactExpression(e);
778780

779781
switch (e.NodeType)
780782
{
783+
case ExpressionType.Lambda:
784+
{
785+
foreach (var parameter in ((LambdaExpression)e).Parameters)
786+
{
787+
nonEvaluatableParameters.Add(parameter);
788+
}
789+
790+
break;
791+
}
792+
781793
case ExpressionType.Constant:
782794
{
783795
if (dc != null && typeof(EntityQueryable<>).IsSameOrParentOf(e.Type) || typeof(DbSet<>).IsSameOrParentOf(e.Type))
@@ -919,14 +931,18 @@ TransformInfo LocalTransform(Expression e)
919931

920932
if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type))
921933
{
922-
// Invoking function to evaluate EF's Subquery located in function
923-
924-
var obj = EvaluateExpression(methodCall.Object);
925-
var arguments = methodCall.Arguments.Select(EvaluateExpression).ToArray();
926-
if (methodCall.Method.Invoke(obj, arguments) is IQueryable result)
934+
if (null == methodCall.Find(nonEvaluatableParameters,
935+
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t)))
927936
{
928-
if (!ExpressionEqualityComparer.Instance.Equals(methodCall, result.Expression))
929-
return new TransformInfo(result.Expression, false, true);
937+
// Invoking function to evaluate EF's Subquery located in function
938+
939+
var obj = EvaluateExpression(methodCall.Object);
940+
var arguments = methodCall.Arguments.Select(EvaluateExpression).ToArray();
941+
if (methodCall.Method.Invoke(obj, arguments) is IQueryable result)
942+
{
943+
if (!ExpressionEqualityComparer.Instance.Equals(methodCall, result.Expression))
944+
return new TransformInfo(result.Expression, false, true);
945+
}
930946
}
931947
}
932948

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
2020
entity.HasNoKey();
2121
entity.ToView("EventsView", "views");
2222
});
23+
24+
modelBuilder.Entity<EntityWithArrays>(entity =>
25+
{
26+
});
2327
}
2428

2529
public virtual DbSet<Event> Events { get; set; } = null!;

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: 3.17.0
5-
nugetVersion: 3.17.0
4+
assemblyVersion: 3.18.0
5+
nugetVersion: 3.18.0
66
artifact_nugets: 'nugets'
77

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

0 commit comments

Comments
 (0)