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

Commit 337a42a

Browse files
committed
Update lowest supported linq2db to 5.4.0 (#380)
* - update dependencies - fix analyzer reports - fix non-ivariant culture uses * update icon (cherry picked from commit c0fb721) # Conflicts: # .editorconfig # Directory.Build.props # Directory.Packages.props # NuGet/linq2db.EntityFrameworkCore.nuspec # Tests/LinqToDB.EntityFrameworkCore.BaseTests/Logging/TestLogger.cs # Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/JsonConverTests.cs # Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/ToolsTests.cs # Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/ValueConversion/ConvertorTests.cs # azure-pipelines.yml (cherry picked from commit d253150) # Conflicts: # Directory.Build.props # Directory.Packages.props # NuGet/linq2db.EntityFrameworkCore.nuspec # Source/LinqToDB.EntityFrameworkCore/Internal/LinqToDBForEFQueryProvider.cs # Tests/LinqToDB.EntityFrameworkCore.BaseTests/Logging/TestLogger.cs # Tests/LinqToDB.EntityFrameworkCore.PostgreSQL.Tests/SampleTests/AAA.cs # Tests/LinqToDB.EntityFrameworkCore.PostgreSQL.Tests/SampleTests/StringExtensions.cs # Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/Settings.cs # azure-pipelines.yml (cherry picked from commit 1ac0155) # Conflicts: # Directory.Build.props # Directory.Packages.props # NuGet/linq2db.EntityFrameworkCore.nuspec # Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFTools.cs # Tests/LinqToDB.EntityFrameworkCore.BaseTests/ForMappingTestsBase.cs # Tests/LinqToDB.EntityFrameworkCore.PostgreSQL.Tests/SampleTests/AAA.cs # Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/ToolsTests.cs # azure-pipelines.yml (cherry picked from commit 3c27d7f) # Conflicts: # Directory.Build.props # Directory.Packages.props # NuGet/linq2db.EntityFrameworkCore.nuspec # Source/LinqToDB.EntityFrameworkCore/EFCoreMetadataReader.cs # Tests/LinqToDB.EntityFrameworkCore.FSharpTests/LinqToDB.EntityFrameworkCore.FSharpTests.fsproj # Tests/LinqToDB.EntityFrameworkCore.PostgreSQL.Tests/SampleTests/AAA.cs # Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/JsonConverTests.cs # azure-pipelines.yml
1 parent 8dcc1f2 commit 337a42a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+35137
-35081
lines changed

.editorconfig

+325-3
Large diffs are not rendered by default.

Directory.Build.props

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<Version>3.26.0</Version>
3+
<Version>3.27.0</Version>
44

55
<Authors>Svyatoslav Danyliv, Igor Tkachev, Dmitry Lukashenko, Ilya Chudin</Authors>
66
<Product>Linq to DB</Product>
77
<Company>linq2db.net</Company>
8-
<Copyright>2002-2023 linq2db.net</Copyright>
8+
<Copyright>2002-2024 linq2db.net</Copyright>
99
<RepositoryUrl>https://github.com/linq2db/linq2db.EntityFrameworkCore</RepositoryUrl>
1010
<RepositoryType>git</RepositoryType>
1111

@@ -29,7 +29,7 @@
2929
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
3030
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
3131
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
32-
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
32+
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
3333

3434
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
3535

Directory.Packages.props

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
<Project>
22
<ItemGroup>
3-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
3+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
44
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
5-
<PackageVersion Include="NUnit" Version="3.13.3" />
5+
<PackageVersion Include="NUnit" Version="3.14.0" />
66
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
77

8-
<PackageVersion Include="linq2db" Version="5.3.1" />
9-
<PackageVersion Include="linq2db.Tools" Version="5.3.1" />
8+
<PackageVersion Include="linq2db" Version="5.4.0" />
9+
<PackageVersion Include="linq2db.Tools" Version="5.4.0" />
10+
11+
<PackageVersion Include="NUnit.Analyzers" Version="4.0.1" />
12+
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.145" />
1013

1114
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
1215
<PackageVersion Include="PolySharp" Version="1.13.2" />
13-
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
1416

1517
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.25" />
16-
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.25" />
1718

19+
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
20+
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.25" />
1821
<PackageVersion Include="Microsoft.Extensions.Logging" Version="5.0.0" />
1922
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
20-
2123
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.7" />
2224
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="3.1.18" />
2325
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.32" />

NuGet/icon.png

18.6 KB
Loading

NuGet/linq2db.EntityFrameworkCore.nuspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<title>Linq to DB (linq2db) extensions for Entity Framework Core</title>
66
<authors>Igor Tkachev, Ilya Chudin, Svyatoslav Danyliv, Dmitry Lukashenko</authors>
77
<owners>Igor Tkachev, Ilya Chudin, Svyatoslav Danyliv, Dmitry Lukashenko</owners>
8-
<copyright>Copyright © 2020-2023 Igor Tkachev, Ilya Chudin, Svyatoslav Danyliv, Dmitry Lukashenko</copyright>
8+
<copyright>Copyright © 2020-2024 Igor Tkachev, Ilya Chudin, Svyatoslav Danyliv, Dmitry Lukashenko</copyright>
99
<description>Allows to execute Linq to DB (linq2db) queries in Entity Framework Core DbContext.</description>
1010
<summary />
1111
<tags>linq linq2db LinqToDB ORM database entity-framework-core EntityFrameworkCore EFCore DB SQL SqlServer SqlCe SqlServerCe MySql Firebird SQLite Oracle ODP PostgreSQL DB2</tags>
@@ -16,7 +16,7 @@
1616
<dependencies>
1717
<group targetFramework="netstandard2.0">
1818
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="3.1.25" />
19-
<dependency id="linq2db" version="5.3.1" />
19+
<dependency id="linq2db" version="5.4.0" />
2020
</group>
2121
</dependencies>
2222
</metadata>

Source/LinqToDB.EntityFrameworkCore/Compatibility/NullableAttributes.cs

-148
This file was deleted.

Source/LinqToDB.EntityFrameworkCore/EFCoreMetadataReader.cs

+16-13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
namespace LinqToDB.EntityFrameworkCore
1919
{
20+
using System.Globalization;
2021
using Common;
2122
using Expressions;
2223
using Extensions;
@@ -50,7 +51,7 @@ public EFCoreMetadataReader(IModel? model, IInfrastructure<IServiceProvider>? ac
5051
_annotationProvider = accessor.GetService<IMigrationsAnnotationProvider>();
5152
}
5253

53-
_objectId = $".{_model?.GetHashCode() ?? 0}.{_dependencies?.GetHashCode() ?? 0}.{_mappingSource?.GetHashCode() ?? 0}.{_annotationProvider?.GetHashCode() ?? 0}.";
54+
_objectId = FormattableString.Invariant($".{_model?.GetHashCode() ?? 0}.{_dependencies?.GetHashCode() ?? 0}.{_mappingSource?.GetHashCode() ?? 0}.{_annotationProvider?.GetHashCode() ?? 0}.");
5455
}
5556

5657
public MappingAttribute[] GetAttributes(Type type)
@@ -121,10 +122,10 @@ public MappingAttribute[] GetAttributes(Type type)
121122
// TableAttribute
122123
var tableAttribute = type.GetAttribute<System.ComponentModel.DataAnnotations.Schema.TableAttribute>();
123124
if (tableAttribute != null)
124-
(result ??= new()).Add(new TableAttribute(tableAttribute.Name) { Schema = tableAttribute.Schema });
125+
(result = new()).Add(new TableAttribute(tableAttribute.Name) { Schema = tableAttribute.Schema });
125126
}
126127

127-
return result == null ? Array.Empty<MappingAttribute>() : result.ToArray();
128+
return result == null ? [] : result.ToArray();
128129
}
129130

130131
static IEntityType GetBaseTypeRecursive(IEntityType entityType)
@@ -218,7 +219,7 @@ static DataType DbTypeToDataType(DbType dbType)
218219
public MappingAttribute[] GetAttributes(Type type, MemberInfo memberInfo)
219220
{
220221
if (typeof(Expression).IsSameOrParentOf(type))
221-
return Array.Empty<MappingAttribute>();
222+
return [];
222223

223224
List<MappingAttribute>? result = null;
224225
var hasColumn = false;
@@ -263,7 +264,7 @@ public MappingAttribute[] GetAttributes(Type type, MemberInfo memberInfo)
263264
.Any(static a =>
264265
{
265266
if (a.Name.EndsWith(":ValueGenerationStrategy"))
266-
return a.Value?.ToString()?.Contains("Identity") == true;
267+
return a.Value != null && string.Format(CultureInfo.InvariantCulture, "{0}", a.Value).Contains("Identity");
267268

268269
if (a.Name.EndsWith(":Autoincrement"))
269270
return a.Value is bool b && b;
@@ -273,7 +274,9 @@ public MappingAttribute[] GetAttributes(Type type, MemberInfo memberInfo)
273274
{
274275
if (a.Value is string str)
275276
{
276-
return str.ToLowerInvariant().Contains("nextval");
277+
#pragma warning disable CA1862 // Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
278+
return str.ToUpperInvariant().Contains("NEXTVAL");
279+
#pragma warning restore CA1862 // Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
277280
}
278281
}
279282

@@ -429,7 +432,7 @@ public MappingAttribute[] GetAttributes(Type type, MemberInfo memberInfo)
429432
});
430433
}
431434

432-
return result == null ? Array.Empty<MappingAttribute>() : result.ToArray();
435+
return result == null ? [] : result.ToArray();
433436
}
434437

435438
sealed class ValueConverter : IValueConverter
@@ -586,7 +589,7 @@ string PrepareExpressionText(Expression? expr)
586589
}
587590

588591
if (idx >= 0)
589-
return $"{{{idx}}}";
592+
return FormattableString.Invariant($"{{{idx}}}");
590593

591594
if (expr is SqlFragmentExpression fragment)
592595
return fragment.Sql;
@@ -599,16 +602,16 @@ string PrepareExpressionText(Expression? expr)
599602

600603
if (!sqlFunction.IsNiladic)
601604
{
602-
text = text + "(";
605+
text += "(";
603606
for (var i = 0; i < sqlFunction.Arguments.Count; i++)
604607
{
605608
var paramText = PrepareExpressionText(sqlFunction.Arguments[i]);
606609
if (i > 0)
607-
text = text + ", ";
608-
text = text + paramText;
610+
text += ", ";
611+
text += paramText;
609612
}
610613

611-
text = text + ")";
614+
text += ")";
612615
}
613616

614617
return text;
@@ -658,7 +661,7 @@ private static Expression UnwrapConverted(Expression expr)
658661

659662
public MemberInfo[] GetDynamicColumns(Type type)
660663
{
661-
return Array.Empty<MemberInfo>();
664+
return [];
662665
}
663666

664667
string IMetadataReader.GetObjectID() => _objectId;

Source/LinqToDB.EntityFrameworkCore/Internal/EFCoreExpressionAttribute.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Globalization;
34
using System.Linq;
45
using System.Linq.Expressions;
56
using LinqToDB.Mapping;
@@ -10,7 +11,7 @@ namespace LinqToDB.EntityFrameworkCore.Internal
1011
/// <summary>
1112
/// Maps Linq To DB expression.
1213
/// </summary>
13-
public class EFCoreExpressionAttribute : Sql.ExpressionAttribute
14+
public sealed class EFCoreExpressionAttribute : Sql.ExpressionAttribute
1415
{
1516
/// <summary>
1617
/// Creates instance of expression mapper.
@@ -47,7 +48,7 @@ public EFCoreExpressionAttribute(string expression) : base(expression)
4748
_ = ResolveExpressionValues((context, parms, knownExpressions, converter), Expression!,
4849
static (ctx, v, d) =>
4950
{
50-
var idx = int.Parse(v);
51+
var idx = int.Parse(v, CultureInfo.InvariantCulture);
5152

5253
if (ctx.parms[idx] == null)
5354
ctx.parms[idx] = ctx.converter(ctx.context, ctx.knownExpressions[idx], null);

Source/LinqToDB.EntityFrameworkCore/Internal/LinqToDBForEFQueryProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ TResult IAsyncQueryProvider.ExecuteAsync<TResult>(Expression expression, Cancell
107107
{
108108
var item = typeof(TResult).GetGenericArguments()[0];
109109
var method = _executeAsyncMethodInfo.MakeGenericMethod(item);
110-
return (TResult) method.Invoke(QueryProvider, new object[] { expression, cancellationToken })!;
110+
return (TResult)method.Invoke(QueryProvider, [expression, cancellationToken])!;
111111
}
112112

113113
/// <summary>

0 commit comments

Comments
 (0)