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

Commit 60a74d5

Browse files
authored
Merge pull request #197 from linq2db/version6
Release 6.6.0
2 parents ce91e91 + bebb3b6 commit 60a74d5

File tree

5 files changed

+63
-10
lines changed

5 files changed

+63
-10
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.5.0</Version>
3+
<Version>6.6.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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
44
<PackageVersion Include="NUnit3TestAdapter" Version="4.0.0" />
55
<PackageVersion Include="NUnit" Version="3.13.2" />
6-
<PackageVersion Include="FluentAssertions" Version="5.10.3" />
6+
<PackageVersion Include="FluentAssertions" Version="6.2.0" />
77

8-
<PackageVersion Include="linq2db" Version="3.5.1" />
9-
<PackageVersion Include="linq2db.Tools" Version="3.5.0" />
8+
<PackageVersion Include="linq2db" Version="3.5.2" />
9+
<PackageVersion Include="linq2db.Tools" Version="3.5.2" />
1010

11-
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.0.0" />
11+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
1212

1313
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0" />
1414
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0" />
1515

1616
<PackageVersion Include="Microsoft.Extensions.Logging" Version="6.0.0" />
1717
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
1818

19-
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0-preview.7" />
19+
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0" />
2020
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0-rc.2" />
2121
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" />
2222
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />

Tests/LinqToDB.EntityFrameworkCore.BaseTests/ForMappingTestsBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public virtual void TestAmbiguousProperties()
113113
{
114114
using var context = CreateContext();
115115

116-
FluentActions.Awaiting(() => context.WithDuplicateProperties.Where(x => x.Value == 1)
117-
.ToArrayAsyncLinqToDB()).Should().NotThrow();
116+
FluentActions.Invoking(() => context.WithDuplicateProperties.Where(x => x.Value == 1)
117+
.ToArray()).Should().NotThrow();
118118
}
119119

120120
}

Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/QueryableExtensions.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Linq.Expressions;
5+
using System.Reflection;
56
using System.Threading;
67
using System.Threading.Tasks;
78
using Microsoft.EntityFrameworkCore.Query;
@@ -10,6 +11,58 @@ namespace LinqToDB.EntityFrameworkCore.SqlServer.Tests
1011
{
1112
public static class QueryableExtensions
1213
{
14+
public static IQueryable<T> AnyFromItems<T, TItem>(this IQueryable<T> source, IEnumerable<TItem> items,
15+
string propName)
16+
{
17+
var entityParam = Expression.Parameter(typeof(T), "e");
18+
var itemParam = Expression.Parameter(typeof(TItem), "i");
19+
20+
var anyPredicate =
21+
Expression.Lambda(
22+
Expression.Equal(itemParam, Expression.PropertyOrField(entityParam, propName)),
23+
itemParam);
24+
25+
var filterLambda =
26+
Expression.Lambda<Func<T, bool>>(
27+
Expression.Call(typeof(Enumerable), nameof(Enumerable.Any), new[] { typeof(TItem) },
28+
Expression.Constant(items), anyPredicate),
29+
entityParam);
30+
31+
return source.Where(filterLambda);
32+
}
33+
34+
public static IQueryable<T> AnyFromItems<T>(this IQueryable<T> source, string items, string propName)
35+
{
36+
var strItems = items.Split(",", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
37+
38+
var entityParam = Expression.Parameter(typeof(T), "e");
39+
var propExpression = Expression.PropertyOrField(entityParam, propName);
40+
var itemType = propExpression.Type;
41+
var itemParam = Expression.Parameter(itemType, "i");
42+
43+
var anyPredicate =
44+
Expression.Lambda(
45+
Expression.Equal(itemParam, Expression.PropertyOrField(entityParam, propName)),
46+
itemParam);
47+
48+
// apply conversion
49+
var itemsExpression = Expression.Call(typeof(QueryableExtensions), nameof(QueryableExtensions.ParseItems),
50+
new[] { itemType }, Expression.Constant(strItems));
51+
52+
var filterLambda =
53+
Expression.Lambda<Func<T, bool>>(
54+
Expression.Call(typeof(Enumerable), nameof(Enumerable.Any), new[] { itemType },
55+
itemsExpression, anyPredicate),
56+
entityParam);
57+
58+
return source.Where(filterLambda);
59+
}
60+
61+
private static IEnumerable<TItem> ParseItems<TItem>(IEnumerable<string> items)
62+
{
63+
return items.Select(i => (TItem)Convert.ChangeType(i, typeof(TItem)));
64+
}
65+
1366
public static async Task<IEnumerable<T>> FilterExistentAsync<T, TProp>(this ICollection<T> items,
1467
IQueryable<T> dbQuery, Expression<Func<T, TProp>> prop, CancellationToken cancellationToken = default)
1568
{

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.5.0
5-
nugetVersion: 6.5.0
4+
assemblyVersion: 6.6.0
5+
nugetVersion: 6.6.0
66
artifact_nugets: 'nugets'
77

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

0 commit comments

Comments
 (0)