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

Commit 968100c

Browse files
authored
Build updates (v5) (#336)
* updates, enable analyzers, warn-as-error # Conflicts: # Build/linq2db.Tests.props # Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs # Conflicts: # Build/linq2db.Default.props # Build/linq2db.Tests.props # Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs * update deps, bump version, modernize build
1 parent 0192e4c commit 968100c

File tree

27 files changed

+95
-104
lines changed

27 files changed

+95
-104
lines changed

.editorconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# EditorConfig is awesome: https://EditorConfig.org
2-
31
root = true
42

53
[*]

Build/linq2db.Default.props renamed to Directory.Build.props

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<Project>
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<Version>5.15.0</Version>
3+
<Version>5.18.0</Version>
44

55
<Authors>Svyatoslav Danyliv, Igor Tkachev, Dmitry Lukashenko, Ilya Chudin</Authors>
66
<Product>Linq to DB</Product>
@@ -11,8 +11,10 @@
1111

1212
<LangVersion>latest</LangVersion>
1313
<Nullable>enable</Nullable>
14-
<WarningLevel>4</WarningLevel>
14+
<WarningLevel>9999</WarningLevel>
1515
<ErrorReport>prompt</ErrorReport>
16+
<Features>strict</Features>
17+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
1618

1719
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
1820
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
@@ -27,15 +29,22 @@
2729
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
2830
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
2931
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
32+
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
3033

3134
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
3235

33-
<CheckEolTargetFramework>false</CheckEolTargetFramework>
36+
<!--required for SkipLocalInit-->
37+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
38+
39+
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
3440
</PropertyGroup>
3541

3642
<PropertyGroup>
37-
<AnalysisLevel>preview</AnalysisLevel>
38-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
39-
<RunAnalyzers>true</RunAnalyzers>
43+
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
44+
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
45+
<AnalysisLevel>preview-All</AnalysisLevel>
46+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
47+
<ReportAnalyzer>true</ReportAnalyzer>
48+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
4049
</PropertyGroup>
4150
</Project>

Directory.Packages.props

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<Project>
22
<ItemGroup>
3-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
4-
<PackageVersion Include="NUnit3TestAdapter" Version="4.4.2" />
3+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
4+
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
55
<PackageVersion Include="NUnit" Version="3.13.3" />
6-
<PackageVersion Include="FluentAssertions" Version="6.11.0" />
6+
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
77

8-
<PackageVersion Include="linq2db" Version="5.2.1" />
9-
<PackageVersion Include="linq2db.Tools" Version="5.2.1" />
8+
<PackageVersion Include="linq2db" Version="5.3.0" />
9+
<PackageVersion Include="linq2db.Tools" Version="5.3.0" />
1010

1111
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
12+
<PackageVersion Include="PolySharp" Version="1.13.2" />
1213

1314
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.17" />
1415
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.17" />
@@ -22,6 +23,6 @@
2223
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.17" />
2324

2425
<PackageVersion Include="EntityFrameworkCore.FSharp" Version="5.0.3" />
25-
<PackageVersion Include="FSharp.Core" Version="7.0.300" />
26+
<PackageVersion Include="FSharp.Core" Version="7.0.400" />
2627
</ItemGroup>
2728
</Project>

NuGet/linq2db.EntityFrameworkCore.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<dependencies>
1717
<group targetFramework="netstandard2.1">
1818
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="5.0.17" />
19-
<dependency id="linq2db" version="5.2.1" />
19+
<dependency id="linq2db" version="5.3.0" />
2020
</group>
2121
</dependencies>
2222
</metadata>

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFTools.Extensions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ public static partial class LinqToDBForEFTools
1313
public static ITable<T> ToLinqToDBTable<T>(this DbSet<T> dbSet)
1414
where T : class
1515
{
16-
var context = Implementation.GetCurrentContext(dbSet);
17-
if (context == null)
18-
throw new LinqToDBForEFToolsException($"Can not load current context from {nameof(dbSet)}");
19-
16+
var context = Implementation.GetCurrentContext(dbSet)
17+
?? throw new LinqToDBForEFToolsException($"Can not load current context from {nameof(dbSet)}");
2018
var dc = CreateLinqToDBContext(context);
2119
return dc.GetTable<T>();
2220
}

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ TransformInfo LocalTransform(Expression e)
971971
fromSqlQueryRoot.Argument));
972972
}
973973
else if (dc != null && e is QueryRootExpression queryRoot)
974-
{
974+
{
975975
var newExpr = Expression.Call(null, Methods.LinqToDB.GetTable.MakeGenericMethod(queryRoot.EntityType.ClrType), Expression.Constant(dc));
976976
return new TransformInfo(newExpr);
977977
}
@@ -1043,19 +1043,13 @@ static bool IsEnumerableType(Type type, MappingSchema mappingSchema)
10431043
var compilerField = typeof (EntityQueryProvider).GetField("_queryCompiler", BindingFlags.NonPublic | BindingFlags.Instance)!;
10441044
var compiler = (QueryCompiler)compilerField.GetValue(query.Provider)!;
10451045

1046-
var queryContextFactoryField = compiler.GetType().GetField("_queryContextFactory", BindingFlags.NonPublic | BindingFlags.Instance);
1047-
1048-
if (queryContextFactoryField == null)
1049-
throw new LinqToDBForEFToolsException($"Can not find private field '{compiler.GetType()}._queryContextFactory' in current EFCore Version.");
1050-
1046+
var queryContextFactoryField = compiler.GetType().GetField("_queryContextFactory", BindingFlags.NonPublic | BindingFlags.Instance)
1047+
?? throw new LinqToDBForEFToolsException($"Can not find private field '{compiler.GetType()}._queryContextFactory' in current EFCore Version.");
10511048
if (queryContextFactoryField.GetValue(compiler) is not RelationalQueryContextFactory queryContextFactory)
10521049
throw new LinqToDBForEFToolsException("LinqToDB Tools for EFCore support only Relational Databases.");
10531050

1054-
var dependenciesProperty = typeof(RelationalQueryContextFactory).GetField("_dependencies", BindingFlags.NonPublic | BindingFlags.Instance);
1055-
1056-
if (dependenciesProperty == null)
1057-
throw new LinqToDBForEFToolsException($"Can not find private property '{nameof(RelationalQueryContextFactory)}._dependencies' in current EFCore Version.");
1058-
1051+
var dependenciesProperty = typeof(RelationalQueryContextFactory).GetField("_dependencies", BindingFlags.NonPublic | BindingFlags.Instance)
1052+
?? throw new LinqToDBForEFToolsException($"Can not find private property '{nameof(RelationalQueryContextFactory)}._dependencies' in current EFCore Version.");
10591053
var dependencies = (QueryContextDependencies) dependenciesProperty.GetValue(queryContextFactory);
10601054

10611055
return dependencies.CurrentContext?.Context;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using System.Runtime.CompilerServices;
2+
3+
[module: SkipLocalsInit]

Source/LinqToDB.EntityFrameworkCore/linq2db.EntityFrameworkCore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<Import Project="..\..\Build\linq2db.Default.props" />
4-
53
<PropertyGroup>
64
<Description>Allows to execute Linq to DB (linq2db) queries in Entity Framework Core DbContext.</Description>
75
<Title>Linq to DB (linq2db) extensions for Entity Framework Core</Title>
@@ -24,6 +22,8 @@
2422
<ItemGroup>
2523
<PackageReference Include="linq2db" />
2624
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" />
25+
26+
<PackageReference Include="PolySharp" />
2727
<PackageReference Include="Microsoft.SourceLink.GitHub">
2828
<PrivateAssets>all</PrivateAssets>
2929
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>

Build/linq2db.Tests.props renamed to Tests/Directory.Build.props

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<Project>
2-
<Import Project="linq2db.Default.props" />
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Import Project="$(MSBuildThisFileDirectory)\..\Directory.Build.props" />
33

44
<PropertyGroup>
55
<TargetFramework>net5.0</TargetFramework>
6+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
7+
<NoWarn>$(NoWarn);CS1591</NoWarn>
68
</PropertyGroup>
7-
9+
810
<ItemGroup>
911
<PackageReference Include="Microsoft.NET.Test.Sdk" />
1012
<PackageReference Include="NUnit3TestAdapter">

Tests/LinqToDB.EntityFrameworkCore.BaseTests/Interceptors/TestEntityServiceInterceptor.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System.Data.Common;
2-
using System.Threading;
3-
using System.Threading.Tasks;
4-
using LinqToDB.Interceptors;
1+
using LinqToDB.Interceptors;
52

63
namespace LinqToDB.EntityFrameworkCore.BaseTests.Interceptors
74
{

0 commit comments

Comments
 (0)