Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make code .NET10-compatible #359

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<MSExtVersion Condition="'$(TargetFramework)' == 'net9.0'">9.0.0</MSExtVersion>
<MSExtVersion Condition="'$(TargetFramework)' == 'net10.0'">10.0.0</MSExtVersion>
<MSExtVersion Condition="'$(TargetFramework)' == 'net9.0'">9.0.2</MSExtVersion>
<MSExtVersion Condition="'$(TargetFramework)' == 'net10.0'">9.0.2</MSExtVersion>
<MSExtVersion2>$(MSExtVersion)</MSExtVersion2>
<MSExtVersion2 Condition="'$(TargetFramework)' == 'net10.0'">10.0.0</MSExtVersion2>
<MSExtVersion2 Condition="'$(TargetFramework)' == 'net10.0'">9.0.2</MSExtVersion2>
</PropertyGroup>
<ItemGroup Label="Nupkg Versions">
<PackageVersion Include="System.CodeDom" Version="$(MSExtVersion)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ protected override DomainConfiguration BuildConfiguration()
[Test]
public void ParentsContainsChildWithImplicitCastTest()
{
var parents = GlobalSession.Query.All<Parent>().ToArray();
IReadOnlyList<Parent> parents = GlobalSession.Query.All<Parent>().ToArray();
var result = GlobalSession.Query.All<Child>().Where(child => parents.Contains(child)).ToArray();
}

[Test]
public void ParentsContainsChildWithExplicitCastTest()
{
var parents = GlobalSession.Query.All<Parent>().ToArray();
IReadOnlyList<Parent> parents = GlobalSession.Query.All<Parent>().ToArray();
var result = GlobalSession.Query.All<Child>().Where(child => parents.Contains(child as Parent)).ToArray();
}

Expand All @@ -76,7 +76,7 @@ public void ChildInParentsTest()
[Test]
public void ChildContainsParentWithImplicitCast()
{
var children = GlobalSession.Query.All<Child>().ToArray();
IReadOnlyList<Child> children = GlobalSession.Query.All<Child>().ToArray();
var result = GlobalSession.Query.All<Child>().Where(a => children.Contains(a.Parent)).ToArray();
}

Expand All @@ -94,4 +94,4 @@ public void ParentInChildrenTest()
var result = GlobalSession.Query.All<Child>().Where(a => a.Parent.In(children)).ToArray();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public void Case21Test()
{
using (var session = Domain.OpenSession())
using (var tx = session.OpenTransaction()) {
var values = new[] { MyEnum.Bar, MyEnum.Foo };
IReadOnlyList<MyEnum> values = [MyEnum.Bar, MyEnum.Foo];
var result = session.Query.All<TestEntity>()
.Select(e => values.Contains(e.List.FirstOrDefault().Link.Value3.Value)).ToArray();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void SelectContainsTest()
{
using (var session = Domain.OpenSession())
using (var tx = session.OpenTransaction()) {
var values = new[] {MyEnum.Bar, MyEnum.Foo};
IReadOnlyList<MyEnum> values = [MyEnum.Bar, MyEnum.Foo];
var query = session.Query.All<EntityWithNullableEnum>()
.Select(e => new {
Id = e.Id,
Expand Down Expand Up @@ -101,7 +101,7 @@ public void SelectContainsWithRefTest()
{
using (var session = Domain.OpenSession())
using (var tx = session.OpenTransaction()) {
var values = new[] {MyEnum.Bar, MyEnum.Foo};
IReadOnlyList<MyEnum> values = [MyEnum.Bar, MyEnum.Foo];
var query = session.Query.All<RefEntity>()
.Select(e => new {
Id = e.Id,
Expand Down Expand Up @@ -130,4 +130,4 @@ public void SelectConditionWithRefTest()
}
}
}
}
}
6 changes: 5 additions & 1 deletion Orm/Xtensive.Orm/Orm/QueryableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ public static bool In<T>(this T source, IncludeAlgorithm algorithm, IEnumerable<
values == null ? false : values.Contains(source);
#pragma warning restore IDE0060 // Remove unused parameter

[Obsolete("Use '.OuterJoin()' extension instead.")]
public static IQueryable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector) =>
OuterJoin(outer, inner, outerKeySelector, innerKeySelector, resultSelector);

/// <summary>
/// Correlates the elements of two sequences based on matching keys.
/// </summary>
Expand All @@ -322,7 +326,7 @@ public static bool In<T>(this T source, IncludeAlgorithm algorithm, IEnumerable<
/// <returns></returns>
/// <exception cref="ArgumentNullException">One of provided arguments is <see langword="null" />.</exception>
/// <exception cref="NotSupportedException">Queryable is not a <see cref="Xtensive.Orm.Linq"/> query.</exception>
public static IQueryable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector)
public static IQueryable<TResult> OuterJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector)
{
ArgumentNullException.ThrowIfNull(outer);
ArgumentNullException.ThrowIfNull(inner);
Expand Down