Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Handlebars support for EF Core 9 #2667

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/vsix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
mkdir vsix
7z x src/GUI/lib/efreveng90.exe.zip -oefreveng90 -y
dir /a:-d /s /b "efreveng90" | find /c ":\" > filecount.txt
findstr "144" filecount.txt
findstr "146" filecount.txt

- name: Build
run: msbuild EFCorePowerTools.sln /property:Configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m
Expand All @@ -79,7 +79,7 @@ jobs:
mkdir vsix
7z x src/GUI/EFCorePowerTools/bin/Release/EFCorePowerTools.vsix -ovsix -y
dir /a:-d /s /b "vsix" | find /c ":\" > filecount.txt
findstr "81" filecount.txt
findstr "82" filecount.txt

- name: Move build output
if: github.ref == 'refs/heads/master' && github.repository_owner == 'erikej' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
Expand Down
5 changes: 2 additions & 3 deletions src/Core/RevEng.Core.80/ServiceProviderBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
#if !CORE90
using EntityFrameworkCore.Scaffolding.Handlebars;
using FirebirdSql.EntityFrameworkCore.Firebird.Design.Internal;
#endif
using EntityFrameworkCore.Scaffolding.Handlebars;
using ErikEJ.EntityFrameworkCore.SqlServer.Scaffolding;
using Humanizer.Inflections;
using Microsoft.EntityFrameworkCore.Design;
Expand Down Expand Up @@ -68,7 +68,6 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti
serviceCollection.AddSingleton<ICandidateNamingService>(provider => new ReplacingCandidateNamingService(options.UsePrefixNavigationNaming, options.CustomReplacers, options.PreserveCasingWithRegex));
}

#if !CORE90
if (options.UseHandleBars)
{
serviceCollection.AddHandlebarsScaffolding(hbOptions =>
Expand All @@ -79,7 +78,7 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti
serviceCollection.AddSingleton<ITemplateFileService>(provider
=> new CustomTemplateFileService(options.OptionsPath));
}
#endif

if (options.UseInflector || options.UseLegacyPluralizer)
{
if (options.UseLegacyPluralizer)
Expand Down
8 changes: 2 additions & 6 deletions src/Core/RevEng.Core.90/RevEng.Core.90.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,16 @@
<Compile Include="..\RevEng.Core.80\Diagram\*.cs" Link="Diagram\%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<Compile Remove="..\RevEng.Core.80\CustomTemplateFileService.cs" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="DbContextExtensionsSqlQuery" />
<EmbeddedResource Include="DbContextExtensionsSqlQuery.Sync" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Bricelam.EntityFrameworkCore.Pluralizer" Version="1.0.0" />
<PackageReference Include="EntityFrameworkCore.Scaffolding.Handlebars" Version="9.0.0-beta1" />
<PackageReference Include="EntityFrameworkCore.Sqlite.NodaTime" Version="9.1.0" />
<!-- <PackageReference Include="EntityFrameworkCore.Scaffolding.Handlebars" Version="8.0.0" />
<PackageReference Include="FirebirdSql.EntityFrameworkCore.Firebird" Version="11.0.0" />-->
<!-- <PackageReference Include="FirebirdSql.EntityFrameworkCore.Firebird" Version="11.0.0" />-->
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
Expand Down
Binary file added src/GUI/EFCorePowerTools/CodeTemplates900.zip
Binary file not shown.
3 changes: 3 additions & 0 deletions src/GUI/EFCorePowerTools/EFCorePowerTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@
<Content Include="CodeTemplates800.zip">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="CodeTemplates900.zip">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<None Include="Key.snk" />
<Content Include="PowerToolsReadMe.md">
<IncludeInVSIX>true</IncludeInVSIX>
Expand Down
3 changes: 3 additions & 0 deletions src/GUI/Shared/Helpers/ReverseEngineerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public string DropTemplates(string optionsPath, string projectPath, CodeGenerati
case CodeGenerationMode.EFCore8:
zipName = "CodeTemplates800.zip";
break;
case CodeGenerationMode.EFCore9:
zipName = "CodeTemplates900.zip";
break;
default:
throw new ArgumentException($"Unsupported code generation mode for templates: {codeGenerationMode}");
}
Expand Down