Skip to content

Commit

Permalink
Merge pull request #221 from linq2db/version6
Browse files Browse the repository at this point in the history
Release 6.7.0
  • Loading branch information
sdanyliv authored Apr 8, 2022
2 parents 152ee43 + a784bbc commit f8b900a
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Build/linq2db.Default.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>6.6.0</Version>
<Version>6.7.0</Version>

<Authors>Svyatoslav Danyliv, Igor Tkachev, Dmitry Lukashenko, Ilya Chudin</Authors>
<Product>Linq to DB</Product>
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<PackageVersion Include="NUnit" Version="3.13.2" />
<PackageVersion Include="FluentAssertions" Version="6.2.0" />

<PackageVersion Include="linq2db" Version="3.5.2" />
<PackageVersion Include="linq2db.Tools" Version="3.5.2" />
<PackageVersion Include="linq2db" Version="3.7.0" />
<PackageVersion Include="linq2db.Tools" Version="3.7.0" />

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

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="net6.0">
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="6.0.0" />
<dependency id="linq2db" version="3.5.2" />
<dependency id="linq2db" version="3.7.0" />
</group>
</dependencies>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,24 @@ public virtual Expression TransformExpression(Expression expression, IDataContex
var tracking = true;
var ignoreTracking = false;

var nonEvaluatableParameters = new HashSet<ParameterExpression>();

TransformInfo LocalTransform(Expression e)
{
e = CompactExpression(e);

switch (e.NodeType)
{
case ExpressionType.Lambda:
{
foreach (var parameter in ((LambdaExpression)e).Parameters)
{
nonEvaluatableParameters.Add(parameter);
}

break;
}

case ExpressionType.Constant:
{
if (dc != null && typeof(EntityQueryable<>).IsSameOrParentOf(e.Type) || typeof(DbSet<>).IsSameOrParentOf(e.Type))
Expand Down Expand Up @@ -905,14 +917,18 @@ TransformInfo LocalTransform(Expression e)

if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type))
{
// Invoking function to evaluate EF's Subquery located in function

var obj = EvaluateExpression(methodCall.Object);
var arguments = methodCall.Arguments.Select(EvaluateExpression).ToArray();
if (methodCall.Method.Invoke(obj, arguments) is IQueryable result)
if (null == methodCall.Find(nonEvaluatableParameters,
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t)))
{
if (!ExpressionEqualityComparer.Instance.Equals(methodCall, result.Expression))
return new TransformInfo(result.Expression, false, true);
// Invoking function to evaluate EF's Subquery located in function

var obj = EvaluateExpression(methodCall.Object);
var arguments = methodCall.Arguments.Select(EvaluateExpression).ToArray();
if (methodCall.Method.Invoke(obj, arguments) is IQueryable result)
{
if (!ExpressionEqualityComparer.Instance.Equals(methodCall, result.Expression))
return new TransformInfo(result.Expression, false, true);
}
}
}

Expand Down
18 changes: 18 additions & 0 deletions Tests/LinqToDB.EntityFrameworkCore.PostgreSQL.Tests/NpgSqlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,23 @@ where Sql.Ext.PostgreSQL().Overlaps(m.Guids, guids)
}
}

[Test]
public void TestUnnest()
{
using var db = CreateNpgSqlEntitiesContext();
using var dc = db.CreateLinqToDbConnection();

var guids = new Guid[] { Guid.Parse("271425b1-ebe8-400d-b71d-a6e47a460ae3"),
Guid.Parse("b75de94e-6d7b-4c70-bfa1-f8639a6a5b35") };

var query =
from m in db.EntityWithArrays.ToLinqToDBTable()
from g in dc.Unnest(m.Guids)
where Sql.Ext.PostgreSQL().Overlaps(m.Guids, guids)
select m;

query.Invoking(q => q.ToArray()).Should().NotThrow();
}

}
}
6 changes: 3 additions & 3 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: 6.6.0
nugetVersion: 6.6.1
assemblyVersion: 6.7.0
nugetVersion: 6.7.0
artifact_nugets: 'nugets'

# build on commits to important branches (master + release branches):
Expand All @@ -25,7 +25,7 @@ stages:
jobs:
- job: build_job
pool:
vmImage: 'windows-2019'
vmImage: 'windows-2022'
variables:
packageVersion: $(nugetVersion)
displayName: 'Build'
Expand Down

0 comments on commit f8b900a

Please sign in to comment.