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

Commit 6acab8a

Browse files
authored
Merge pull request #251 from linq2db/version6
Release 6.9.0
2 parents cc95fae + f236039 commit 6acab8a

File tree

10 files changed

+111
-11
lines changed

10 files changed

+111
-11
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>6.8.0</Version>
3+
<Version>6.9.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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<PackageVersion Include="NUnit" Version="3.13.3" />
66
<PackageVersion Include="FluentAssertions" Version="6.6.0" />
77

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

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

@@ -20,5 +20,8 @@
2020
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.4" />
2121
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.5" />
2222
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.5" />
23+
24+
<PackageVersion Include="EntityFrameworkCore.FSharp" Version="6.0.7" />
25+
<PackageVersion Include="FSharp.Core" Version="6.0.5" />
2326
</ItemGroup>
2427
</Project>

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="net6.0">
1818
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="6.0.5" />
19-
<dependency id="linq2db" version="4.0.1" />
19+
<dependency id="linq2db" version="4.2.0" />
2020
</group>
2121
</dependencies>
2222
</metadata>

Source/LinqToDB.EntityFrameworkCore/EFCoreMetadataReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ public override int GetHashCode()
523523
var objExpr = new SqlTransparentExpression(Expression.Constant(DefaultValue.GetValue(type), type), _mappingSource?.FindMapping(propInfo));
524524

525525
var newExpression = _dependencies.MemberTranslatorProvider.Translate(objExpr, propInfo, propInfo.GetMemberType(), _logger!);
526-
if (newExpression != null)
526+
if (newExpression != null && newExpression != objExpr)
527527
{
528528
var parametersArray = new Expression[] { objExpr };
529529
result = ConvertToExpressionAttribute(propInfo, newExpression, parametersArray);

Source/LinqToDB.EntityFrameworkCore/Internal/LinqToDBForEFQueryProvider.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Linq.Expressions;
66
using System.Reflection;
7+
using System.Runtime.CompilerServices;
78
using System.Threading;
89
using System.Threading.Tasks;
910

@@ -160,8 +161,17 @@ IEnumerator IEnumerable.GetEnumerator()
160161
/// <returns>Query result as <see cref="IAsyncEnumerable{T}"/>.</returns>
161162
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken)
162163
{
163-
return Task.Run(() => QueryProvider.ExecuteAsyncEnumerable<T>(Expression, cancellationToken),
164-
cancellationToken).Result.GetAsyncEnumerator(cancellationToken);
164+
async IAsyncEnumerable<T> EnumerateAsyncEnumerable([EnumeratorCancellation] CancellationToken ct)
165+
{
166+
var asyncEnumerable = await QueryProvider.ExecuteAsyncEnumerable<T>(Expression, ct)
167+
.ConfigureAwait(false);
168+
await foreach (var item in asyncEnumerable.WithCancellation(ct).ConfigureAwait(false))
169+
{
170+
yield return item;
171+
}
172+
}
173+
174+
return EnumerateAsyncEnumerable(cancellationToken).GetAsyncEnumerator(cancellationToken);
165175
}
166176

167177
/// <summary>

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsDataConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public TypeKey(IEntityType entityType, IModel? model)
140140
}
141141

142142
public IEntityType EntityType { get; }
143-
public IModel? Model { get; }
143+
public IModel? Model { get; }
144144

145145
protected bool Equals(TypeKey other)
146146
{
@@ -187,7 +187,7 @@ object IEntityServiceInterceptor.EntityCreated(EntityCreatedEventData eventData,
187187
return entity;
188188

189189
if (!LinqToDBForEFTools.EnableChangeTracker
190-
|| !Tracking
190+
|| !Tracking
191191
|| Context!.ChangeTracker.QueryTrackingBehavior == QueryTrackingBehavior.NoTracking)
192192
return entity;
193193

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="..\..\Build\linq2db.Tests.props" />
4+
5+
<PropertyGroup>
6+
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<Compile Include="Tests.fs" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\..\Source\LinqToDB.EntityFrameworkCore\linq2db.EntityFrameworkCore.csproj" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
16+
<PackageReference Include="EntityFrameworkCore.FSharp" />
17+
<PackageReference Include="FSharp.Core" />
18+
</ItemGroup>
19+
20+
</Project>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
module LinqToDB.EntityFrameworkCore.FSharpTests
2+
3+
open System.Linq
4+
open LinqToDB
5+
open System.ComponentModel.DataAnnotations
6+
open System.ComponentModel.DataAnnotations.Schema
7+
open Microsoft.EntityFrameworkCore
8+
open EntityFrameworkCore.FSharp.Extensions
9+
open NUnit.Framework
10+
11+
[<CLIMutable>]
12+
type WithIdentity = {
13+
[<Key>]
14+
[<DatabaseGenerated(DatabaseGeneratedOption.Identity)>]
15+
Id : int
16+
Name : string
17+
}
18+
19+
type AppDbContext(options: DbContextOptions<AppDbContext>) =
20+
inherit DbContext(options)
21+
22+
[<DefaultValue>] val mutable WithIdentity : DbSet<WithIdentity>
23+
member this.CompaniesInformation
24+
with get() = this.WithIdentity
25+
and set v = this.WithIdentity <- v
26+
27+
type TestDbContextFactory() =
28+
member this.CreateDbContext() =
29+
let options = new DbContextOptionsBuilder<AppDbContext>()
30+
options.UseSqlite("DataSource=:memory:").UseFSharpTypes() |> ignore
31+
new AppDbContext(options.Options)
32+
33+
[<TestFixture>]
34+
type Tests() =
35+
36+
[<Test>]
37+
member this.TestLeftJoin() =
38+
let context = TestDbContextFactory().CreateDbContext()
39+
let q =
40+
context
41+
.WithIdentity
42+
.Join(
43+
context.WithIdentity,
44+
(fun p -> p.Id),
45+
(fun c -> c.Id),
46+
(fun p c ->
47+
{|
48+
Person = p
49+
Company = c
50+
|}) )
51+
.LeftJoin(
52+
context.WithIdentity,
53+
(fun partialPerson cInfo -> partialPerson.Company.Id = cInfo.Id),
54+
(fun partialPerson cInfo ->
55+
{|
56+
Company = partialPerson.Company
57+
CompanyInformation = cInfo
58+
Person = partialPerson.Person
59+
|}) )
60+
//q.ToArray() |> ignore
61+
q.ToLinqToDB().ToString() |> ignore

azure-pipelines.yml

Lines changed: 2 additions & 2 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: 6.8.0
5-
nugetVersion: 6.8.0
4+
assemblyVersion: 6.9.0
5+
nugetVersion: 6.9.0
66
artifact_nugets: 'nugets'
77

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

linq2db.EFCore.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinqToDB.EntityFrameworkCor
4141
EndProject
4242
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinqToDB.EntityFrameworkCore.SQLite.Tests", "Tests\LinqToDB.EntityFrameworkCore.SQLite.Tests\LinqToDB.EntityFrameworkCore.SQLite.Tests.csproj", "{615C5697-5FA7-490C-8812-3D61994A8AC1}"
4343
EndProject
44+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "LinqToDB.EntityFrameworkCore.FSharpTests", "Tests\LinqToDB.EntityFrameworkCore.FSharpTests\LinqToDB.EntityFrameworkCore.FSharpTests.fsproj", "{ECF4637B-1C93-4D87-BDF2-E7F4DF7ED5C9}"
45+
EndProject
4446
Global
4547
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4648
Debug|Any CPU = Debug|Any CPU
@@ -71,6 +73,10 @@ Global
7173
{615C5697-5FA7-490C-8812-3D61994A8AC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
7274
{615C5697-5FA7-490C-8812-3D61994A8AC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
7375
{615C5697-5FA7-490C-8812-3D61994A8AC1}.Release|Any CPU.Build.0 = Release|Any CPU
76+
{ECF4637B-1C93-4D87-BDF2-E7F4DF7ED5C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
77+
{ECF4637B-1C93-4D87-BDF2-E7F4DF7ED5C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
78+
{ECF4637B-1C93-4D87-BDF2-E7F4DF7ED5C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
79+
{ECF4637B-1C93-4D87-BDF2-E7F4DF7ED5C9}.Release|Any CPU.Build.0 = Release|Any CPU
7480
EndGlobalSection
7581
GlobalSection(SolutionProperties) = preSolution
7682
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)