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

Commit 8c20620

Browse files
authored
Merge pull request #139 from linq2db/master
Release 5.2.1
2 parents 94d0786 + b8fea41 commit 8c20620

File tree

16 files changed

+98
-21
lines changed

16 files changed

+98
-21
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>5.2.0</Version>
3+
<Version>5.2.1</Version>
44

55
<Authors>Svyatoslav Danyliv, Igor Tkachev, Dmitry Lukashenko, Ilya Chudin</Authors>
66
<Product>Linq to DB</Product>

Source/LinqToDB.EntityFrameworkCore/LinqToDBExtensionsAdapter.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,21 @@ public Task<TSource> FirstAsync<TSource>(
8787
=> EntityFrameworkQueryableExtensions.FirstAsync(source, predicate, token);
8888

8989
/// <inheritdoc cref="EntityFrameworkQueryableExtensions.FirstOrDefaultAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
90-
public Task<TSource> FirstOrDefaultAsync<TSource>(
90+
public Task<TSource?> FirstOrDefaultAsync<TSource>(
9191
IQueryable<TSource> source,
9292
CancellationToken token)
93+
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
9394
=> EntityFrameworkQueryableExtensions.FirstOrDefaultAsync(source, token);
95+
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.
9496

9597
/// <inheritdoc cref="EntityFrameworkQueryableExtensions.FirstOrDefaultAsync{TSource}(IQueryable{TSource}, Expression{Func{TSource, bool}}, CancellationToken)"/>
96-
public Task<TSource> FirstOrDefaultAsync<TSource>(
98+
public Task<TSource?> FirstOrDefaultAsync<TSource>(
9799
IQueryable<TSource> source,
98100
Expression<Func<TSource,bool>> predicate,
99101
CancellationToken token)
102+
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
100103
=> EntityFrameworkQueryableExtensions.FirstOrDefaultAsync(source, predicate, token);
104+
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.
101105

102106
/// <inheritdoc cref="EntityFrameworkQueryableExtensions.SingleAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
103107
public Task<TSource> SingleAsync<TSource>(
@@ -113,17 +117,21 @@ public Task<TSource> SingleAsync<TSource>(
113117
=> EntityFrameworkQueryableExtensions.SingleAsync(source, predicate, token);
114118

115119
/// <inheritdoc cref="EntityFrameworkQueryableExtensions.SingleOrDefaultAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
116-
public Task<TSource> SingleOrDefaultAsync<TSource>(
120+
public Task<TSource?> SingleOrDefaultAsync<TSource>(
117121
IQueryable<TSource> source,
118122
CancellationToken token)
123+
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
119124
=> EntityFrameworkQueryableExtensions.SingleOrDefaultAsync(source, token);
125+
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.
120126

121127
/// <inheritdoc cref="EntityFrameworkQueryableExtensions.SingleOrDefaultAsync{TSource}(IQueryable{TSource}, Expression{Func{TSource, bool}}, CancellationToken)"/>
122-
public Task<TSource> SingleOrDefaultAsync<TSource>(
128+
public Task<TSource?> SingleOrDefaultAsync<TSource>(
123129
IQueryable<TSource> source,
124130
Expression<Func<TSource,bool>> predicate,
125131
CancellationToken token)
132+
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
126133
=> EntityFrameworkQueryableExtensions.SingleOrDefaultAsync(source, predicate, token);
134+
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.
127135

128136
/// <inheritdoc cref="EntityFrameworkQueryableExtensions.ContainsAsync{TSource}(IQueryable{TSource}, TSource, CancellationToken)"/>
129137
public Task<bool> ContainsAsync<TSource>(

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFExtensions.Async.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ public static Task<TSource> FirstAsyncLinqToDB<TSource>(
7676
=> AsyncExtensions.FirstAsync(source.ToLinqToDB(), predicate, token);
7777

7878
/// <inheritdoc cref="AsyncExtensions.FirstOrDefaultAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
79-
public static Task<TSource> FirstOrDefaultAsyncLinqToDB<TSource>(
79+
public static Task<TSource?> FirstOrDefaultAsyncLinqToDB<TSource>(
8080
this IQueryable<TSource> source,
8181
CancellationToken token = default)
8282
=> AsyncExtensions.FirstOrDefaultAsync(source.ToLinqToDB(), token);
8383

8484
/// <inheritdoc cref="AsyncExtensions.FirstOrDefaultAsync{TSource}(IQueryable{TSource}, Expression{Func{TSource, bool}}, CancellationToken)"/>
85-
public static Task<TSource> FirstOrDefaultAsyncLinqToDB<TSource>(
85+
public static Task<TSource?> FirstOrDefaultAsyncLinqToDB<TSource>(
8686
this IQueryable<TSource> source,
8787
Expression<Func<TSource,bool>> predicate,
8888
CancellationToken token = default)
@@ -102,13 +102,13 @@ public static Task<TSource> SingleAsyncLinqToDB<TSource>(
102102
=> AsyncExtensions.SingleAsync(source.ToLinqToDB(), predicate, token);
103103

104104
/// <inheritdoc cref="AsyncExtensions.SingleOrDefaultAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
105-
public static Task<TSource> SingleOrDefaultAsyncLinqToDB<TSource>(
105+
public static Task<TSource?> SingleOrDefaultAsyncLinqToDB<TSource>(
106106
this IQueryable<TSource> source,
107107
CancellationToken token = default)
108108
=> AsyncExtensions.SingleOrDefaultAsync(source.ToLinqToDB(), token);
109109

110110
/// <inheritdoc cref="AsyncExtensions.SingleOrDefaultAsync{TSource}(IQueryable{TSource}, Expression{Func{TSource, bool}}, CancellationToken)"/>
111-
public static Task<TSource> SingleOrDefaultAsyncLinqToDB<TSource>(
111+
public static Task<TSource?> SingleOrDefaultAsyncLinqToDB<TSource>(
112112
this IQueryable<TSource> source,
113113
Expression<Func<TSource,bool>> predicate,
114114
CancellationToken token = default)

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFTools.ContextExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ public static async Task<BulkCopyRowsCopied> BulkCopyAsync<T>(
233233
[LinqTunnel]
234234
[Pure]
235235
public static IValueInsertable<T> Into<T>(this DbContext context, ITable<T> target)
236+
where T: notnull
236237
{
237238
if (context == null) throw new ArgumentNullException(nameof(context));
238239
if (target == null) throw new ArgumentNullException(nameof(target));

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,10 @@ public virtual void DefineConvertors(
455455
if (modelType.IsEnum)
456456
continue;
457457

458+
// skipping arrays
459+
if (modelType.IsArray)
460+
continue;
461+
458462
MapEFCoreType(modelType);
459463
if (modelType.IsValueType && !typeof(Nullable<>).IsSameOrParentOf(modelType))
460464
MapEFCoreType(typeof(Nullable<>).MakeGenericType(modelType));

Source/LinqToDB.EntityFrameworkCore/linq2db.EntityFrameworkCore.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,20 @@
1616
<LangVersion>latest</LangVersion>
1717
</PropertyGroup>
1818

19+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
20+
<DebugType>portable</DebugType>
21+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
22+
<DebugSymbols>true</DebugSymbols>
23+
</PropertyGroup>
24+
1925
<ItemGroup>
2026
<PackageReference Include="linq2db" Version="3.3.0" />
2127
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.2" />
28+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
29+
<PrivateAssets>all</PrivateAssets>
30+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
31+
</PackageReference>
32+
2233
</ItemGroup>
2334

2435
</Project>

Tests/LinqToDB.EntityFrameworkCore.BaseTests/Logging/TestLogger.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ internal class TestLogger : ILogger
1313
private static readonly string _newLineWithMessagePadding;
1414

1515
// ConsoleColor does not have a value to specify the 'Default' color
16+
#pragma warning disable 649
1617
private readonly ConsoleColor? DefaultConsoleColor;
18+
#pragma warning restore 649
1719

1820
private readonly string _name;
1921

Tests/LinqToDB.EntityFrameworkCore.BaseTests/TestUtils.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public class TestUtils
1515

1616
.AddTestLogger(o =>
1717
{
18-
o.IncludeScopes = true;
1918
o.FormatterName = ConsoleFormatterNames.Simple;
2019
});
2120
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.ComponentModel.DataAnnotations;
3+
4+
namespace LinqToDB.EntityFrameworkCore.PostgreSQL.Tests.Models.NpgSqlEntities
5+
{
6+
public class EntityWithArrays
7+
{
8+
[Key]
9+
public int Id { get; set; }
10+
11+
public Guid[] Guids { get; set; } = null!;
12+
}
13+
}

Tests/LinqToDB.EntityFrameworkCore.PostgreSQL.Tests/Models/NpgSqlEntities/NpgSqlEnititesContext.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
2020
entity.HasNoKey();
2121
entity.ToView("EventsView", "views");
2222
});
23+
24+
modelBuilder.Entity<EntityWithArrays>(entity =>
25+
{
26+
});
2327
}
2428

2529
public virtual DbSet<Event> Events { get; set; } = null!;
30+
public virtual DbSet<EntityWithArrays> EntityWithArrays { get; set; } = null!;
2631

2732
}
2833
}

0 commit comments

Comments
 (0)