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

Commit 6633aeb

Browse files
committed
Fixed issue with transactions. Updated linq2db version.
1 parent ac830cf commit 6633aeb

File tree

4 files changed

+34
-15
lines changed

4 files changed

+34
-15
lines changed

Source/LinqToDB.EntityFrameworkCore/Internal/LinqToDBForEFQueryProvider.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace LinqToDB.EntityFrameworkCore.Internal
2121
/// It may change or be removed without further notice.
2222
/// </summary>
2323
/// <typeparam name="T"></typeparam>
24-
public class LinqToDBForEFQueryProvider<T> : IAsyncQueryProvider, IQueryable<T>, System.Collections.Generic.IAsyncEnumerable<T>
24+
public class LinqToDBForEFQueryProvider<T> : IAsyncQueryProvider, IQueryProviderAsync, IQueryable<T>, System.Collections.Generic.IAsyncEnumerable<T>
2525
{
2626
public LinqToDBForEFQueryProvider([NotNull] IDataContext dataContext, [NotNull] Expression expression)
2727
{
@@ -59,6 +59,11 @@ public System.Collections.Generic.IAsyncEnumerable<TResult> ExecuteAsync<TResult
5959
return new AsyncEnumerableAdaper<TResult>(QueryProvider.ExecuteAsync<TResult>(expression));
6060
}
6161

62+
IAsyncEnumerable<TResult> IQueryProviderAsync.ExecuteAsync<TResult>(Expression expression)
63+
{
64+
return QueryProvider.ExecuteAsync<TResult>(expression);
65+
}
66+
6267
public Task<TResult> ExecuteAsync<TResult>(Expression expression, CancellationToken cancellationToken)
6368
{
6469
return QueryProvider.ExecuteAsync<TResult>(expression, cancellationToken);

Source/LinqToDB.EntityFrameworkCore/linq2db.EntityFrameworkCore.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="linq2db" Version="2.2.0" />
13-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.1" />
14-
<PackageReference Include="System.Interactive.Async" Version="3.1.1" />
12+
<PackageReference Include="linq2db" Version="2.5.4" />
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.0" />
1514
</ItemGroup>
1615

1716
</Project>

Tests/LinqToDB.EntityFrameworkCore.Tests/LinqToDB.EntityFrameworkCore.Tests.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
<ItemGroup>
88
<PackageReference Include="JetBrains.DotMemoryUnit" Version="3.0.20171219.105559" />
9-
<PackageReference Include="linq2db.MySql" Version="2.0.0-beta5" />
10-
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.1.1" />
11-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.0-rc1-final" />
12-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.0-rc1-final" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
14-
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.0-preview2" />
15-
<PackageReference Include="NUnit" Version="3.10.1" />
16-
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.0.1" />
9+
<PackageReference Include="linq2db" Version="2.5.4" />
10+
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.0" />
11+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
12+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
14+
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.2" />
15+
<PackageReference Include="NUnit" Version="3.11.0" />
16+
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.4" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

Tests/LinqToDB.EntityFrameworkCore.Tests/ToolsTests.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ orderby p.ProductID
274274
}
275275

276276
[Test]
277-
public void TestTransaction()
277+
public async Task TestTransaction()
278278
{
279279
using (var ctx = CreateAdventureWorksContext())
280280
{
@@ -297,8 +297,8 @@ public void TestTransaction()
297297
.Delete();
298298

299299

300-
var test1 = ctx.Products.Where(p => p.Name.StartsWith("U")).MaxAsync(p => p.StandardCost).Result;
301-
var test2 = ctx.Products.Where(p => p.Name.StartsWith("U")).MaxAsyncLinqToDB(p => p.StandardCost).Result;
300+
var test1 = await ctx.Products.Where(p => p.Name.StartsWith("U")).MaxAsync(p => p.StandardCost);
301+
var test2 = await ctx.Products.Where(p => p.Name.StartsWith("U")).MaxAsyncLinqToDB(p => p.StandardCost);
302302

303303
Assert.AreEqual(test1, test2);
304304

@@ -557,6 +557,21 @@ public async Task TestContinuousQueries()
557557

558558
}
559559

560+
[Test]
561+
public async Task TestSetUpdate()
562+
{
563+
using (var ctx = CreateAdventureWorksContext())
564+
{
565+
var customer = await ctx.Customers.FirstOrDefaultAsync();
566+
567+
var updatable = ctx.Customers.Where(c => c.CustomerID == customer.CustomerID)
568+
.Set(c => c.CompanyName, customer.CompanyName);
569+
570+
var affected = updatable
571+
.UpdateAsync();
572+
}
573+
}
574+
560575

561576
}
562577
}

0 commit comments

Comments
 (0)