Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Build/linq2db.Default.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>6.5.0</Version>
<Version>6.6.0</Version>

<Authors>Svyatoslav Danyliv, Igor Tkachev, Dmitry Lukashenko, Ilya Chudin</Authors>
<Product>Linq to DB</Product>
Expand Down
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageVersion Include="NUnit" Version="3.13.2" />
<PackageVersion Include="FluentAssertions" Version="5.10.3" />
<PackageVersion Include="FluentAssertions" Version="6.2.0" />

<PackageVersion Include="linq2db" Version="3.5.1" />
<PackageVersion Include="linq2db.Tools" Version="3.5.0" />
<PackageVersion Include="linq2db" Version="3.5.2" />
<PackageVersion Include="linq2db.Tools" Version="3.5.2" />

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

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

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

<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0-preview.7" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0-rc.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public virtual void TestAmbiguousProperties()
{
using var context = CreateContext();

FluentActions.Awaiting(() => context.WithDuplicateProperties.Where(x => x.Value == 1)
.ToArrayAsyncLinqToDB()).Should().NotThrow();
FluentActions.Invoking(() => context.WithDuplicateProperties.Where(x => x.Value == 1)
.ToArray()).Should().NotThrow();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Query;
Expand All @@ -10,6 +11,58 @@ namespace LinqToDB.EntityFrameworkCore.SqlServer.Tests
{
public static class QueryableExtensions
{
public static IQueryable<T> AnyFromItems<T, TItem>(this IQueryable<T> source, IEnumerable<TItem> items,
string propName)
{
var entityParam = Expression.Parameter(typeof(T), "e");
var itemParam = Expression.Parameter(typeof(TItem), "i");

var anyPredicate =
Expression.Lambda(
Expression.Equal(itemParam, Expression.PropertyOrField(entityParam, propName)),
itemParam);

var filterLambda =
Expression.Lambda<Func<T, bool>>(
Expression.Call(typeof(Enumerable), nameof(Enumerable.Any), new[] { typeof(TItem) },
Expression.Constant(items), anyPredicate),
entityParam);

return source.Where(filterLambda);
}

public static IQueryable<T> AnyFromItems<T>(this IQueryable<T> source, string items, string propName)
{
var strItems = items.Split(",", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);

var entityParam = Expression.Parameter(typeof(T), "e");
var propExpression = Expression.PropertyOrField(entityParam, propName);
var itemType = propExpression.Type;
var itemParam = Expression.Parameter(itemType, "i");

var anyPredicate =
Expression.Lambda(
Expression.Equal(itemParam, Expression.PropertyOrField(entityParam, propName)),
itemParam);

// apply conversion
var itemsExpression = Expression.Call(typeof(QueryableExtensions), nameof(QueryableExtensions.ParseItems),
new[] { itemType }, Expression.Constant(strItems));

var filterLambda =
Expression.Lambda<Func<T, bool>>(
Expression.Call(typeof(Enumerable), nameof(Enumerable.Any), new[] { itemType },
itemsExpression, anyPredicate),
entityParam);

return source.Where(filterLambda);
}

private static IEnumerable<TItem> ParseItems<TItem>(IEnumerable<string> items)
{
return items.Select(i => (TItem)Convert.ChangeType(i, typeof(TItem)));
}

public static async Task<IEnumerable<T>> FilterExistentAsync<T, TProp>(this ICollection<T> items,
IQueryable<T> dbQuery, Expression<Func<T, TProp>> prop, CancellationToken cancellationToken = default)
{
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: 6.5.0
nugetVersion: 6.5.0
assemblyVersion: 6.6.0
nugetVersion: 6.6.0
artifact_nugets: 'nugets'

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