Skip to content

Commit

Permalink
EF Core 8 provider (and refactoring around).
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed May 13, 2024
1 parent 6bce4ed commit f2a5539
Show file tree
Hide file tree
Showing 67 changed files with 1,933 additions and 278 deletions.
27 changes: 19 additions & 8 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ $baseDir = Split-Path -Parent $PSCommandPath
. "$baseDir\include.ps1"

$outDir = "$baseDir\out"
$version = ''
$versionProvider = ''
$versionEFCore = ''
$versionEF6 = ''

function Clean() {
if (Test-Path $outDir) {
Expand All @@ -29,19 +31,28 @@ function Build() {
b 'Restore' $False
b 'Restore'
b 'Build'
$script:version = (Get-Item $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\$(Get-UsedTargetFramework)\FirebirdSql.Data.FirebirdClient.dll).VersionInfo.ProductVersion -replace '(\d+)\.(\d+)\.(\d+)(-[a-z0-9]+)?(.*)','$1.$2.$3$4'
}

function Versions() {
function v($file) {
return (Get-Item $file).VersionInfo.ProductVersion -replace '(\d+)\.(\d+)\.(\d+)(-[a-z0-9]+)?.*','$1.$2.$3$4'
}
$script:versionProvider = v $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\net8.0\FirebirdSql.Data.FirebirdClient.dll
$script:versionEFCore = v $baseDir\src\FirebirdSql.EntityFrameworkCore.Firebird\bin\$Configuration\net8.0\FirebirdSql.EntityFrameworkCore.Firebird.dll
$script:versionEF6 = v $baseDir\src\EntityFramework.Firebird\bin\$Configuration\net48\EntityFramework.Firebird.dll
}

function NuGets() {
cp $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\FirebirdSql.Data.FirebirdClient.$version.nupkg $outDir
cp $baseDir\src\EntityFramework.Firebird\bin\$Configuration\EntityFramework.Firebird.$version.nupkg $outDir
cp $baseDir\src\FirebirdSql.EntityFrameworkCore.Firebird\bin\$Configuration\FirebirdSql.EntityFrameworkCore.Firebird.$version.nupkg $outDir
cp $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\FirebirdSql.Data.FirebirdClient.$versionProvider.nupkg $outDir
cp $baseDir\src\FirebirdSql.EntityFrameworkCore.Firebird\bin\$Configuration\FirebirdSql.EntityFrameworkCore.Firebird.$versionEFCore.nupkg $outDir
cp $baseDir\src\EntityFramework.Firebird\bin\$Configuration\EntityFramework.Firebird.$versionEF6.nupkg $outDir

cp $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\FirebirdSql.Data.FirebirdClient.$version.snupkg $outDir
cp $baseDir\src\EntityFramework.Firebird\bin\$Configuration\EntityFramework.Firebird.$version.snupkg $outDir
cp $baseDir\src\FirebirdSql.EntityFrameworkCore.Firebird\bin\$Configuration\FirebirdSql.EntityFrameworkCore.Firebird.$version.snupkg $outDir
cp $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\FirebirdSql.Data.FirebirdClient.$versionProvider.snupkg $outDir
cp $baseDir\src\FirebirdSql.EntityFrameworkCore.Firebird\bin\$Configuration\FirebirdSql.EntityFrameworkCore.Firebird.$versionEFCore.snupkg $outDir
cp $baseDir\src\EntityFramework.Firebird\bin\$Configuration\EntityFramework.Firebird.$versionEF6.snupkg $outDir
}

Clean
Build
Versions
NuGets
4 changes: 0 additions & 4 deletions include.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@ function Check-ExitCode() {
echo "Non-zero ($exitCode) exit code. Exiting..."
exit $exitCode
}
}

function Get-UsedTargetFramework() {
return 'net8.0'
}
3 changes: 1 addition & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project>
<Import Project="Versions.props" />
<PropertyGroup>
<LangVersion>latest</LangVersion>
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>10.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Company>FirebirdSQL</Company>
<Product>NETProvider</Product>
<Authors>FirebirdSQL</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<PackageReference Include="NUnitLite" Version="3.13.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FirebirdSql.Data.FirebirdClient\FirebirdSql.Data.FirebirdClient.csproj" />
<ProjectReference Include="..\EntityFramework.Firebird\EntityFramework.Firebird.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
8 changes: 6 additions & 2 deletions src/EntityFramework.Firebird/EntityFramework.Firebird.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup>
<Version>$(EF6ProviderVersion)</Version>
<AssemblyTitle>NETProvider - Entity Framework Provider</AssemblyTitle>
<Copyright>(c) 2014-$(CopyrightEndYear)</Copyright>
</PropertyGroup>
Expand Down Expand Up @@ -45,15 +46,18 @@
<None Include="..\..\firebird-logo.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="EntityFramework" Version="$(EF6ReferencePackageVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net48'">
<Reference Include="System.Configuration" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.1'">
</ItemGroup>
<ItemGroup>
<ItemGroup Condition="'$(Configuration)'!='Debug'">
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="$(EF6ReferenceProviderVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<ProjectReference Include="..\FirebirdSql.Data.FirebirdClient\FirebirdSql.Data.FirebirdClient.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<Version>$(ProviderVersion)</Version>
<AssemblyTitle>NETProvider - ADO.NET Data Provider</AssemblyTitle>
<Copyright>(c) 2002-$(CopyrightEndYear)</Copyright>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Specification.Tests" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Specification.Tests" Version="$(EFCoreReferencePackageVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
Expand All @@ -20,7 +20,6 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FirebirdSql.Data.FirebirdClient\FirebirdSql.Data.FirebirdClient.csproj" />
<ProjectReference Include="..\FirebirdSql.EntityFrameworkCore.Firebird\FirebirdSql.EntityFrameworkCore.Firebird.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,30 @@ public static void SetStringLengths(ModelBuilder modelBuilder)
{
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
foreach (var property in entityType.GetProperties())
HandleProperties(entityType.GetProperties());
HandleComplexProperties(entityType.GetComplexProperties());
}

void HandleProperties(IEnumerable<IMutableProperty> properties)
{
foreach (var property in properties)
{
SetStringLength(property);
}
}
void HandleComplexProperties(IEnumerable<IMutableComplexProperty> complexProperties)
{
foreach (var cp in complexProperties)
{
HandleProperties(cp.ComplexType.GetProperties());
HandleComplexProperties(cp.ComplexType.GetComplexProperties());
}
}
void SetStringLength(IMutableProperty property)
{
if (property.ClrType == typeof(string) && property.GetMaxLength() == null)
{
if (property.ClrType == typeof(string) && property.GetMaxLength() == null)
{
property.SetMaxLength(500);
}
property.SetMaxLength(500);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ public MigrationsFbTest(MigrationsFbFixture fixture)
[Fact(Skip = SkipReason)]
public override Task Add_column_with_collation() => base.Add_column_with_collation();

[Fact(Skip = SkipReason)]
public override Task Add_column_computed_with_collation() => base.Add_column_computed_with_collation();
[Theory(Skip = SkipReason)]
[InlineData(true)]
[InlineData(false)]
public override Task Add_column_computed_with_collation(bool stored) => base.Add_column_computed_with_collation(stored);

[Fact(Skip = SkipReason)]
public override Task Add_column_shared() => base.Add_column_shared();
Expand Down Expand Up @@ -324,6 +326,36 @@ public MigrationsFbTest(MigrationsFbFixture fixture)
[Fact(Skip = SkipReason)]
public override Task Drop_primary_key_string() => base.Drop_primary_key_string();

[Fact(Skip = SkipReason)]
public override Task Alter_sequence_restart_with() => base.Alter_sequence_restart_with();

[Fact(Skip = SkipReason)]
public override Task Add_column_with_unbounded_max_length() => base.Add_column_with_unbounded_max_length();

[Fact(Skip = SkipReason)]
public override Task Add_optional_primitive_collection_to_existing_table() => base.Add_optional_primitive_collection_to_existing_table();

[Fact(Skip = SkipReason)]
public override Task Add_required_primitve_collection_to_existing_table() => base.Add_required_primitve_collection_to_existing_table();

[Fact(Skip = SkipReason)]
public override Task Add_required_primitve_collection_with_custom_converter_and_custom_default_value_to_existing_table() => base.Add_required_primitve_collection_with_custom_converter_and_custom_default_value_to_existing_table();

[Fact(Skip = SkipReason)]
public override Task Add_required_primitve_collection_with_custom_default_value_to_existing_table() => base.Add_required_primitve_collection_with_custom_default_value_to_existing_table();

[Fact(Skip = SkipReason)]
public override Task Create_table_with_complex_type_with_required_properties_on_derived_entity_in_TPH() => base.Create_table_with_complex_type_with_required_properties_on_derived_entity_in_TPH();

[Fact(Skip = SkipReason)]
public override Task Create_table_with_optional_primitive_collection() => base.Create_table_with_optional_primitive_collection();

[Fact(Skip = SkipReason)]
public override Task Create_table_with_required_primitive_collection() => base.Create_table_with_required_primitive_collection();

[Fact(Skip = SkipReason)]
public override Task Add_required_primitve_collection_with_custom_default_value_sql_to_existing_table() => Task.CompletedTask;

public class MigrationsFbFixture : MigrationsFixtureBase
{
protected override string StoreName => nameof(MigrationsFbTest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,11 @@ public override Task Take_Select_collection_Take(bool async)
{
return base.Take_Select_collection_Take(async);
}

[NotSupportedOnFirebirdTheory]
[MemberData(nameof(IsAsyncData))]
public override Task Filtered_include_Skip_Take_with_another_Skip_Take_on_top_level(bool async)
{
return base.Filtered_include_Skip_Take_with_another_Skip_Take_on_top_level(async);
}
}
Loading

0 comments on commit f2a5539

Please sign in to comment.