Skip to content

Commit a86a6f9

Browse files
authored
EFCore 7.0 and around (#124)
1 parent 19ee5db commit a86a6f9

File tree

123 files changed

+5619
-587
lines changed

Some content is hidden

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

123 files changed

+5619
-587
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
- name: Checkout
2020
uses: actions/checkout@v2
2121

22-
- name: .NET 6.0
22+
- name: .NET 7.0
2323
uses: actions/setup-dotnet@v1
2424
with:
25-
dotnet-version: 6.0.x
25+
dotnet-version: 7.0.x
2626

2727
- name: Build
2828
run: |

header.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ gci $baseDir -Recurse -Filter *.cs | %{
3232
}
3333
}
3434
if (!$started) {
35-
//echo $_.FullName
35+
#echo $_.FullName
3636
return
3737
}
3838

include.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ function Check-ExitCode() {
77
}
88

99
function Get-UsedTargetFramework() {
10-
return 'net6.0'
10+
return 'net7.0'
1111
}

src/EntityFramework.Firebird.Tests/EntityFramework.Firebird.Tests.csproj

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net6.0</TargetFramework>
3+
<!-- Figure out a way to run it on net4.8 (FirebirdSql.Data.TestsBase uses IAsyncDisposable) -->
4+
<TargetFramework>net7.0</TargetFramework>
45
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
56
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
67
<SkipSourceLink>true</SkipSourceLink>
@@ -11,7 +12,7 @@
1112
<OutputType>Exe</OutputType>
1213
<StartupObject>FirebirdSql.Data.TestsBase.Program</StartupObject>
1314
</PropertyGroup>
14-
<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
15+
<ItemGroup Condition="'$(TargetFramework)'=='net7.0'">
1516
<None Remove="app.config" />
1617
</ItemGroup>
1718
<ItemGroup>
@@ -25,7 +26,7 @@
2526
<ProjectReference Include="..\EntityFramework.Firebird\EntityFramework.Firebird.csproj" />
2627
</ItemGroup>
2728
<ItemGroup>
28-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
29+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
2930
</ItemGroup>
3031
<Import Project="..\FirebirdSql.Data.TestsBase\FirebirdSql.Data.TestsBase.projitems" Label="Shared" />
3132
</Project>

src/EntityFramework.Firebird.Tests/EntityFrameworkTestsBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public abstract class EntityFrameworkTestsBase : FbTestsBase
2727
{
2828
static EntityFrameworkTestsBase()
2929
{
30-
#if NET6_0_OR_GREATER
30+
#if !NETFRAMEWORK
3131
System.Data.Common.DbProviderFactories.RegisterFactory(FbProviderServices.ProviderInvariantName, FirebirdClientFactory.Instance);
3232
#endif
3333
DbConfiguration.SetConfiguration(new FbTestDbContext.Conf());

src/EntityFramework.Firebird/EntityFramework.Firebird.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111
<PropertyGroup>
1212
<AssemblyTitle>NETProvider - Entity Framework Provider</AssemblyTitle>
13-
<Copyright>(c) 2014-2021</Copyright>
13+
<Copyright>(c) 2014-2023</Copyright>
1414
</PropertyGroup>
1515
<PropertyGroup>
1616
<PackageId>EntityFramework.Firebird</PackageId>

src/EntityFramework.Firebird/SqlGen/SqlGenerator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2552,7 +2552,7 @@ private static ISqlFragment HandleCanonicalFunctionBitwiseAnd(SqlGenerator sqlge
25522552

25532553
private static ISqlFragment HandleCanonicalFunctionBitwiseNot(SqlGenerator sqlgen, DbFunctionExpression e)
25542554
{
2555-
throw new NotSupportedException("BitwiseNot is not supported by Firebird.");
2555+
return sqlgen.HandleFunctionDefaultGivenName(e, "BIN_NOT");
25562556
}
25572557

25582558
private static ISqlFragment HandleCanonicalFunctionBitwiseOr(SqlGenerator sqlgen, DbFunctionExpression e)

src/FirebirdSql.Data.FirebirdClient.Tests/FirebirdSql.Data.FirebirdClient.Tests.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net6.0</TargetFramework>
3+
<TargetFramework>net7.0</TargetFramework>
44
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
55
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
66
<SkipSourceLink>true</SkipSourceLink>
@@ -22,6 +22,6 @@
2222
</ItemGroup>
2323
<Import Project="..\FirebirdSql.Data.TestsBase\FirebirdSql.Data.TestsBase.projitems" Label="Shared" />
2424
<ItemGroup>
25-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
25+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
2626
</ItemGroup>
2727
</Project>

src/FirebirdSql.Data.FirebirdClient/FirebirdSql.Data.FirebirdClient.csproj

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net48;netstandard2.0;netstandard2.1;net5.0;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net48;netstandard2.0;netstandard2.1;net5.0;net6.0;net7.0</TargetFrameworks>
44
<AssemblyName>FirebirdSql.Data.FirebirdClient</AssemblyName>
55
<RootNamespace>FirebirdSql.Data</RootNamespace>
66
<SignAssembly>true</SignAssembly>
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212
<PropertyGroup>
1313
<AssemblyTitle>NETProvider - ADO.NET Data Provider</AssemblyTitle>
14-
<Copyright>(c) 2002-2021</Copyright>
14+
<Copyright>(c) 2002-2023</Copyright>
1515
</PropertyGroup>
1616
<PropertyGroup>
1717
<PackageId>FirebirdSql.Data.FirebirdClient</PackageId>
@@ -51,6 +51,8 @@
5151
</ItemGroup>
5252
<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
5353
</ItemGroup>
54+
<ItemGroup Condition="'$(TargetFramework)'=='net7.0'">
55+
</ItemGroup>
5456
<ItemGroup>
5557
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0.1">
5658
<PrivateAssets>all</PrivateAssets>

src/FirebirdSql.Data.FirebirdClient/Logging/LogMessages.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,4 @@ public static void TransactionRolledBackRetaining(IFbLogger log, FbTransaction t
286286
}
287287

288288
static bool IsNullParameterValue(object value) => value == DBNull.Value || value == null;
289-
}
289+
}

src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.csproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net6.0</TargetFramework>
3+
<TargetFramework>net7.0</TargetFramework>
44
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
55
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
66
<SkipSourceLink>true</SkipSourceLink>
77
<AssemblyName>FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests</AssemblyName>
88
<RootNamespace>FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests</RootNamespace>
99
<SignAssembly>true</SignAssembly>
1010
<AssemblyOriginatorKeyFile>..\FirebirdSql.Data.TestsBase\FirebirdSql.Data.TestsBase.snk</AssemblyOriginatorKeyFile>
11+
<PreserveCompilationContext>true</PreserveCompilationContext>
1112
</PropertyGroup>
1213
<ItemGroup>
13-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Specification.Tests" Version="6.0.11" />
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Specification.Tests" Version="7.0.10" />
1415
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
1516
<PackageReference Include="xunit" Version="2.4.2" />
1617
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">

src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Helpers/ModelHelpers.cs

+34-2
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,23 @@ public static void SimpleTableNames(ModelBuilder modelBuilder)
4747
{
4848
if (entityType.BaseType != null)
4949
continue;
50-
var name = new string(entityType.GetTableName().Where(char.IsUpper).ToArray());
50+
entityType.SetTableName(Simplify(entityType.GetTableName()));
51+
foreach (var property in entityType.GetProperties())
52+
{
53+
property.SetColumnName(Simplify(property.Name));
54+
}
55+
}
56+
57+
string Simplify(string name)
58+
{
59+
name = new string(name.Where(char.IsUpper).ToArray());
5160
var cnt = 1;
5261
while (names.Contains(name))
5362
{
5463
name += cnt++;
5564
}
5665
names.Add(name);
57-
entityType.SetTableName(name);
66+
return name;
5867
}
5968
}
6069

@@ -76,4 +85,27 @@ public static void SetPrimaryKeyGeneration(ModelBuilder modelBuilder, FbValueGen
7685
}
7786
}
7887
}
88+
89+
public static void ShortenMM(ModelBuilder modelBuilder)
90+
{
91+
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
92+
{
93+
entityType.SetTableName(Shorten(entityType.ShortName()));
94+
foreach (var property in entityType.GetProperties())
95+
{
96+
property.SetColumnName(Shorten(property.Name));
97+
}
98+
}
99+
100+
static string Shorten(string s)
101+
{
102+
return s
103+
.Replace("UnidirectionalEntity", "UE")
104+
.Replace("Unidirectional", "U")
105+
.Replace("JoinOneToThree", "J1_3")
106+
.Replace("EntityTableSharing", "ETS")
107+
.Replace("GeneratedKeys", "GK")
108+
.Replace("ImplicitManyToMany", "IMM");
109+
}
110+
}
79111
}

src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Helpers/SkippingAttributes.cs

+15
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,18 @@ public LongExecutionTheoryAttribute()
9393
Skip = "Long execution.";
9494
}
9595
}
96+
97+
public class NotSupportedByProviderFactAttribute : FactAttribute
98+
{
99+
public NotSupportedByProviderFactAttribute()
100+
{
101+
Skip = "Not supported by provider.";
102+
}
103+
}
104+
public class NotSupportedByProviderTheoryAttribute : TheoryAttribute
105+
{
106+
public NotSupportedByProviderTheoryAttribute()
107+
{
108+
Skip = "Not supported by provider.";
109+
}
110+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1-
using Xunit;
1+
/*
2+
* The contents of this file are subject to the Initial
3+
* Developer's Public License Version 1.0 (the "License");
4+
* you may not use this file except in compliance with the
5+
* License. You may obtain a copy of the License at
6+
* https://github.com/FirebirdSQL/NETProvider/raw/master/license.txt.
7+
*
8+
* Software distributed under the License is distributed on
9+
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
10+
* express or implied. See the License for the specific
11+
* language governing rights and limitations under the License.
12+
*
13+
* All Rights Reserved.
14+
*/
215

3-
[assembly: CollectionBehavior(DisableTestParallelization = true)]
16+
//$Authors = Jiri Cincura ([email protected])
17+
18+
using Xunit;
19+
20+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/MigrationsFbTest.cs

+37-7
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,12 @@ public MigrationsFbTest(MigrationsFbFixture fixture)
204204
[Fact(Skip = SkipReason)]
205205
public override Task Rename_index() => base.Rename_index();
206206

207-
[Fact(Skip = SkipReason)]
208-
public override Task Add_primary_key() => base.Add_primary_key();
209-
210207
[Fact(Skip = SkipReason)]
211208
public override Task Add_primary_key_with_name() => base.Add_primary_key_with_name();
212209

213210
[Fact(Skip = SkipReason)]
214211
public override Task Add_primary_key_composite_with_name() => base.Add_primary_key_composite_with_name();
215212

216-
[Fact(Skip = SkipReason)]
217-
public override Task Drop_primary_key() => base.Drop_primary_key();
218-
219213
[Fact(Skip = SkipReason)]
220214
public override Task Add_foreign_key() => base.Add_foreign_key();
221215

@@ -294,13 +288,49 @@ public MigrationsFbTest(MigrationsFbFixture fixture)
294288
[Fact(Skip = SkipReason)]
295289
public override Task SqlOperation() => base.SqlOperation();
296290

291+
[Fact(Skip = SkipReason)]
292+
public override Task Add_primary_key_int() => base.Add_primary_key_int();
293+
294+
[Fact(Skip = SkipReason)]
295+
public override Task Add_primary_key_string() => base.Add_primary_key_string();
296+
297+
[Fact(Skip = SkipReason)]
298+
public override Task Alter_column_change_computed_recreates_indexes() => base.Alter_column_change_computed_recreates_indexes();
299+
300+
[Fact(Skip = SkipReason)]
301+
public override Task Alter_column_make_required_with_null_data() => base.Alter_column_make_required_with_null_data();
302+
303+
[Fact(Skip = SkipReason)]
304+
public override Task Alter_index_change_sort_order() => base.Alter_index_change_sort_order();
305+
306+
[Fact(Skip = SkipReason)]
307+
public override Task Alter_index_make_unique() => base.Alter_index_make_unique();
308+
309+
[Fact(Skip = SkipReason)]
310+
public override Task Create_index_descending() => base.Create_index_descending();
311+
312+
[Fact(Skip = SkipReason)]
313+
public override Task Create_index_descending_mixed() => base.Create_index_descending_mixed();
314+
315+
[Fact(Skip = SkipReason)]
316+
public override Task Create_sequence_long() => base.Create_sequence_long();
317+
318+
[Fact(Skip = SkipReason)]
319+
public override Task Create_sequence_short() => base.Create_sequence_short();
320+
321+
[Fact(Skip = SkipReason)]
322+
public override Task Drop_primary_key_int() => base.Drop_primary_key_int();
323+
324+
[Fact(Skip = SkipReason)]
325+
public override Task Drop_primary_key_string() => base.Drop_primary_key_string();
326+
297327
public class MigrationsFbFixture : MigrationsFixtureBase
298328
{
299329
protected override string StoreName => nameof(MigrationsFbTest);
300330

301331
protected override ITestStoreFactory TestStoreFactory => FbTestStoreFactory.Instance;
302332

303-
public override TestHelpers TestHelpers => FbTestHelpers.Instance;
333+
public override RelationalTestHelpers TestHelpers => FbTestHelpers.Instance;
304334

305335
protected override IServiceCollection AddServices(IServiceCollection serviceCollection)
306336
#pragma warning disable EF1001

0 commit comments

Comments
 (0)