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

Commit 521cc80

Browse files
MaceWindusdanyliv
andauthored
Issue/321 (#322)
* add test * bad fix * Excluded linq2db methods from evaluation. * use modern blob types in tests --------- Co-authored-by: Svyatoslav Danyliv <[email protected]>
1 parent 99b0651 commit 521cc80

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ TransformInfo LocalTransform(Expression e)
916916
break;
917917
}
918918

919-
if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type))
919+
if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type) && methodCall.Type.Assembly != typeof(LinqExtensions).Assembly)
920920
{
921921
if (null == methodCall.Find(nonEvaluatableParameters,
922922
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t)))

Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/IssueTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Diagnostics.CodeAnalysis;
22
using System.Linq;
33
using FluentAssertions;
4+
using LinqToDB.DataProvider.SqlServer;
45
using LinqToDB.EntityFrameworkCore.BaseTests;
56
using LinqToDB.EntityFrameworkCore.SqlServer.Tests.Models.IssueModel;
67
using Microsoft.EntityFrameworkCore;
@@ -81,5 +82,12 @@ from p in ctx.Patents.Include(p => p.Assessment)
8182
Assert.That(db.LastQuery, Does.Not.Contain("INNER"));
8283
}
8384

85+
[Test]
86+
public void Issue321Test()
87+
{
88+
using var ctx = CreateContext();
89+
90+
var _ = ctx.Patents.AsSqlServer().ToLinqToDB().ToArray();
91+
}
8492
}
8593
}

Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/Models/Northwind.Mapping/CategoriesMap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public override void Configure(EntityTypeBuilder<Category> builder)
2222
.IsRequired()
2323
.HasMaxLength(15);
2424

25-
builder.Property(e => e.Description).HasColumnType("ntext");
25+
builder.Property(e => e.Description).HasColumnType("nvarchar(max)");
2626

27-
builder.Property(e => e.Picture).HasColumnType("image");
27+
builder.Property(e => e.Picture).HasColumnType("varbinary(max)");
2828
}
2929
}
3030
}

Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/Models/Northwind.Mapping/CustomerDemographicsMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public override void Configure(EntityTypeBuilder<CustomerDemographics> builder)
1818
.HasMaxLength(10)
1919
.ValueGeneratedNever();
2020

21-
builder.Property(e => e.CustomerDesc).HasColumnType("ntext");
21+
builder.Property(e => e.CustomerDesc).HasColumnType("nvarchar(max)");
2222
}
2323
}
2424
}

Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/Models/Northwind.Mapping/EmployeesMap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public override void Configure(EntityTypeBuilder<Employee> builder)
4343
.IsRequired()
4444
.HasMaxLength(20);
4545

46-
builder.Property(e => e.Notes).HasColumnType("ntext");
46+
builder.Property(e => e.Notes).HasColumnType("nvarchar(max)");
4747

48-
builder.Property(e => e.Photo).HasColumnType("image");
48+
builder.Property(e => e.Photo).HasColumnType("varbinary(max)");
4949

5050
builder.Property(e => e.PhotoPath).HasMaxLength(255);
5151

Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/Models/Northwind.Mapping/SuppliersMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public override void Configure(EntityTypeBuilder<Supplier> builder)
3737

3838
builder.Property(e => e.Fax).HasMaxLength(24);
3939

40-
builder.Property(e => e.HomePage).HasColumnType("ntext");
40+
builder.Property(e => e.HomePage).HasColumnType("nvarchar(max)");
4141

4242
builder.Property(e => e.Phone).HasMaxLength(24);
4343

0 commit comments

Comments
 (0)