See the documentation (/doc/README.md
).
If you have a local repository
git checkout-index --prefix=git-export-dir/ -a
Or create a new GitHub repository from template:
https://github.com/havit/NewProjectTemplate-Blazor/generate
- SetupSolution.ps1 (replaces
NewProjectTemplate
withYourProjectName
etc.)- Open SetupSolution.ps1 and set parameters.
- Run SetupSolution.ps1.
- Delete SetupSolution.ps1
- Set Web.Server as the startup project.
- Adjust the Model - remove unnecessary entities (Country, Localizations, ...)
- Rebuild the solution
- Run DataLayer CodeGenerator (Run-CodeGenerator.ps1)
- Create an initial EF migration
- Drop the current migrations - delete Entity/Migrations folder
- Add new initial migration
Add-Migration Initial
- Check all configuration files (including PublishScripts folder).
- Remove connection string AzureKeyVault from appsettings.WebServer.Development.json (or update the endpoint).
- Run the app...
- Update NuGet packages in solution.
- Application Insights - configure connection string
(Use PublishScripts folder for deployment settings.)
- Replace the
<TargetFramework>net8.0</TargetFramework>
to<TargetFramework>net9.0</TargetFramework>
in all.csproj
files. - Update NuGet package references from 8.0.x to 9.0.x version + update other NuGet packages as needed (for EF Core 9 upgrade see below).
- Build: Clean solution & Rebuild solution
- Check the
TfsPublish.xml
. There might be explicitnet8.0
target, remove the line. - Update the
Web.Server.csproj
theEnsureWebJobInPackage
target to usenet9.0
in paths. - Implement Static Assets Middleware (
MapStaticAssets
instead ofUseStaticFiles
,App.razor
adjustments, custom versioning removal, ...) - Remove link to
_content/Havit.Blazor.Components.Web.Bootstrap/defaults.css
. - If you use it, upgrade your GitHub workflow YAML to use net9.
- Update HFW NuGet packages and Microsoft packages to EF Core 9.
- Update the dotnet tool
Havit.Data.EntityFrameworkCore.CodeGenerator.Tool
(dotnet tool update Havit.Data.EntityFrameworkCore.CodeGenerator.Tool
). - Build the Entity project (building the entire solution will fail initially).
- Run the code generator.
- Adjust Before Commit Processors (if any) to accommodate the new return values.
- Update method overrides for
PerformAddForInsert/Update/Delete
in custom Unit of Work, if needed. - Modify the service registration in dependency injection:
- Remove the call to
WithEntityPatterns
, - Remove the call to
AddEntityPatterns
, - Add the generic parameter
IDbContext
to theAddDbContext
call, - Add
UseDefaultHavitConventions()
to theoptionsBuilder
in theAddDbContext
call, - Replace
AddDataLayer
withAddDataLayerServices
(remove the assembly argument), - Add a call to
AddDataSeeds
if data seeds are used.
- Remove the call to
- Methods
AddLocalizationServices
andAddLookupServices
remain unchanged.
services
.AddDbContext<IDbContext, MyShopDbContext>(optionsBuilder =>
{
string databaseConnectionString = configuration.Configuration.GetConnectionString("Database");
optionsBuilder.UseSqlServer(databaseConnectionString, c => c.MaxBatchSize(30));
optionsBuilder.UseDefaultHavitConventions();
})
.AddDataLayerServices()
.AddDataSeeds(typeof(CoreProfile).Assembly)
.AddLocalizationServices<Language>();