Skip to content

Commit

Permalink
backport from v3
Browse files Browse the repository at this point in the history
  • Loading branch information
MaceWindu committed May 18, 2023
1 parent 37fc750 commit c094fba
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 25 deletions.
12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.4.2" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="FluentAssertions" Version="6.10.0" />
<PackageVersion Include="FluentAssertions" Version="6.11.0" />

<PackageVersion Include="linq2db" Version="5.0.0" />
<PackageVersion Include="linq2db.Tools" Version="5.0.0" />
<PackageVersion Include="linq2db" Version="5.2.1" />
<PackageVersion Include="linq2db.Tools" Version="5.2.1" />

<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
Expand All @@ -19,7 +19,7 @@
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />

<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.6" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.4" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="2.2.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ TransformInfo LocalTransform(Expression e)
methodCall.Arguments[1]), false, true);
}

if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type))
if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type) && methodCall.Type.Assembly != typeof(LinqExtensions).Assembly)
{
if (null == methodCall.Find(nonEvaluatableParameters,
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.ForNpgsqlUseXminAsConcurrencyToken();
});

modelBuilder.Entity<TimeStampEntity>(e =>
{
e.Property(e => e.Timestamp1).HasColumnType("timestamp");
e.Property(e => e.Timestamp2).HasColumnType("timestamp");
e.Property(e => e.TimestampTZ1).HasColumnType("timestamp with time zone");
e.Property(e => e.TimestampTZ2).HasColumnType("timestamp with time zone");
e.Property(e => e.TimestampTZ3).HasColumnType("timestamp with time zone");
});
}

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

public virtual DbSet<TimeStampEntity> TimeStamps { get; set; } = null!;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using NodaTime;

namespace LinqToDB.EntityFrameworkCore.PostgreSQL.Tests.Models.NpgSqlEntities
{
public class TimeStampEntity
{
public int Id { get; set; }
public DateTime Timestamp1 { get; set; }
public LocalDateTime Timestamp2 { get; set; }
public DateTime TimestampTZ1 { get; set; }
public DateTimeOffset TimestampTZ2 { get; set; }
public Instant TimestampTZ3 { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using LinqToDB.EntityFrameworkCore.BaseTests;
using LinqToDB.EntityFrameworkCore.PostgreSQL.Tests.Models.NpgSqlEntities;
using Microsoft.EntityFrameworkCore;
using NodaTime;
using NUnit.Framework;

namespace LinqToDB.EntityFrameworkCore.PostgreSQL.Tests
Expand All @@ -23,10 +24,9 @@ static NpgSqlTests()
public NpgSqlTests()
{
var optionsBuilder = new DbContextOptionsBuilder<NpgSqlEnititesContext>();
//new SqlServerDbContextOptionsBuilder(optionsBuilder);

//optionsBuilder.UseNpgsql("Server=DBHost;Port=5432;Database=TestData;User Id=postgres;Password=TestPassword;Pooling=true;MinPoolSize=10;MaxPoolSize=100;");
optionsBuilder.UseNpgsql("Server=localhost;Port=5415;Database=TestData;User Id=postgres;Password=Password12!;Pooling=true;MinPoolSize=10;MaxPoolSize=100;");
//optionsBuilder.UseNpgsql("Server=DBHost;Port=5432;Database=TestData;User Id=postgres;Password=TestPassword;Pooling=true;MinPoolSize=10;MaxPoolSize=100;", o => o.UseNodaTime());
optionsBuilder.UseNpgsql("Server=localhost;Port=5415;Database=TestData;User Id=postgres;Password=Password12!;Pooling=true;MinPoolSize=10;MaxPoolSize=100;", o => o.UseNodaTime());
optionsBuilder.UseLoggerFactory(TestUtils.LoggerFactory);

_options = optionsBuilder.Options;
Expand Down Expand Up @@ -102,7 +102,6 @@ public void TestConcurrencyToken()
db.BulkCopy(toInsert);
}


[Test]
public void TestUnnest()
{
Expand All @@ -120,6 +119,5 @@ where Sql.Ext.PostgreSQL().Overlaps(m.Guids, guids)

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

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using FluentAssertions;
using LinqToDB.DataProvider.SqlServer;
using LinqToDB.EntityFrameworkCore.BaseTests;
using LinqToDB.EntityFrameworkCore.SqlServer.Tests.Models.IssueModel;
using Microsoft.EntityFrameworkCore;
Expand Down Expand Up @@ -79,5 +80,12 @@ from p in ctx.Patents.Include(p => p.Assessment)
Assert.That(db.LastQuery, Does.Not.Contain("INNER"));
}

[Test]
public void Issue321Test()
{
using var ctx = CreateContext();

var _ = ctx.Patents.AsSqlServer().ToLinqToDB().ToArray();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public override void Configure(EntityTypeBuilder<Category> builder)
.IsRequired()
.HasMaxLength(15);

builder.Property(e => e.Description).HasColumnType("ntext");
builder.Property(e => e.Description).HasColumnType("nvarchar(max)");

builder.Property(e => e.Picture).HasColumnType("image");
builder.Property(e => e.Picture).HasColumnType("varbinary(max)");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public override void Configure(EntityTypeBuilder<CustomerDemographics> builder)
.HasMaxLength(10)
.ValueGeneratedNever();

builder.Property(e => e.CustomerDesc).HasColumnType("ntext");
builder.Property(e => e.CustomerDesc).HasColumnType("nvarchar(max)");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public override void Configure(EntityTypeBuilder<Employee> builder)
.IsRequired()
.HasMaxLength(20);

builder.Property(e => e.Notes).HasColumnType("ntext");
builder.Property(e => e.Notes).HasColumnType("nvarchar(max)");

builder.Property(e => e.Photo).HasColumnType("image");
builder.Property(e => e.Photo).HasColumnType("varbinary(max)");

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override void Configure(EntityTypeBuilder<Supplier> builder)

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

builder.Property(e => e.HomePage).HasColumnType("ntext");
builder.Property(e => e.HomePage).HasColumnType("nvarchar(max)");

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

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: 2.10.0
nugetVersion: 2.10.0
assemblyVersion: 2.11.0
nugetVersion: 2.11.0
artifact_nugets: 'nugets'

# build on commits to important branches (master + release branches):
Expand Down

0 comments on commit c094fba

Please sign in to comment.