Upgrade Guide

Upgrading an EasyAdminBlazor project to a new version. Read the Changelog first and check for breaking changes.

1. Before Upgrading

  • Back up the database: upgrades may involve schema changes
  • Validate on a test environment: do not upgrade the production database directly
  • Read the changelog to confirm dependency upgrades, security fixes, and configuration changes in this release

2. Upgrade NuGet Packages

Check the currently referenced versions:

dotnet list package

Upgrade the core package and extensions:

# Upgrade the core package to the latest
dotnet add package EasyAdminBlazor

# Upgrade the extensions you use
dotnet add package EasyAdminBlazor.Mail
dotnet add package EasyAdminBlazor.Redis
dotnet add package EasyAdminBlazor.Scheduler
# ...install/upgrade as needed

You can also upgrade from the "Manage NuGet Packages" UI in Visual Studio. It is recommended to keep the core and extension packages at the same version.

3. Update the Template Package

The template package is updated separately; re-running the install command overwrites it with the latest version:

dotnet new install EasyAdminBlazor.Templates

Existing projects are not affected; new projects will use the latest template.

4. Verification After Upgrading

  1. Clean the bin and obj directories (stale build artifacts can interfere)
  2. Rebuild: dotnet build
  3. Start on a development environment with UseAutoSyncStructure(true) and confirm new tables/columns are synced
  4. Check the changelog for breaking changes (renamed settings, API changes, changed defaults)
  5. Walk through the key features: login, user/role/menu, operation logs, file upload, code generator
  6. Deploy to production only after verification (see Deployment)

5. Common Notes

  • Database schema: upgrades may add tables or columns. After development sync passes, sync on production (or follow the deployment guide to disable auto-sync and run manual change scripts)

  • Cache: restart the process after upgrading; if Redis is used, clean stale keys when necessary

  • AesKey / AdminRouteSecret: unless the changelog explicitly requires it, do not change them during upgrade; whether existing sessions are invalidated depends on the changelog

  • v2.3.2 login ticket upgrade: tickets move to v2, so legacy v1 tickets are treated as signed-out and every user must log in once after upgrading (AesKey now also derives the Data Protection application name)

  • v2.3.2 multi-tenant host whitelist: when multi-tenant is enabled, configure Security:AllowedHosts (admin domains); leaving it empty keeps the previous unrestricted behaviour

  • v2.3.2 operation log gains two columns: SysOperationLog adds EntityType, EntityKey and the idx_operationlog_entity index (used by the change-history view). With UseAutoSyncStructure(true) they are created automatically; when auto-sync is disabled in production, run the equivalent ALTER TABLE ... ADD COLUMN ... and CREATE INDEX ... manually

  • v2.6.0 the controlled download of private files has been removed (breaking change): the /api/files/{id} endpoint and the FileService.OpenPrivateFileAsync method are gone; files are served from their static URL. If your own code references any of these members, switch to SysFile.AccessUrl (the access address on the file record). None of the framework's built-in extension packages reference them -- every one of them has been checked. The SysFile.IsPublic field stays on the entity but no longer takes part in any decision -- it is kept so that the schema of existing databases stays as it is and upgrading projects need no database change

  • v2.6.0 approval record gains one column: SysApprovalRecord adds TotalLevels (INT NULL, the level count of the flow at submit time). A running bill is governed by that value, so changing the flow configuration afterwards (adding or removing a level) no longer changes the number of nodes of a bill that is already in flight -- such bills no longer stay stuck in "under approval". The framework runs CodeFirst.SyncStructure<SysApprovalRecord>() on startup and adds the column automatically; when auto-sync is disabled in production, run ALTER TABLE sys_approval_record ADD COLUMN TotalLevels INT NULL; manually. Legacy rows have a null value and fall back to "snapshot level count, then flow configuration", which behaves exactly as before the upgrade

  • v2.6.0 image pixel limit: a new FileSettings:MaxImagePixels setting (default 40 million pixels, roughly a 160MB decode buffer) blocks crafted images that are tiny on disk but eat gigabytes once decoded. The trade-off is that camera originals above 48 million pixels are rejected; raise the value when needed (set it to 0 to disable the limit)

  • v2.6.0 large column flag properties: if you use the "large column flag" (Is{Column} / {Column}Length), the flag property must carry [Column(IsIgnore = true)] -- otherwise it is treated as a real column and written to the database, overwriting a real column of the same name. Check the flag properties you added earlier for this attribute

  • v2.7.0 AesKey is now required (breaking change): EasyAdminBlazorOptions.AesKey no longer has a built-in default (the old EasyAdminBlazorKey! is gone); encryption/decryption of sensitive fields throws immediately when it is missing. Supply it before upgrading in AddEasyAdminBlazor(new EasyAdminBlazorOptions { AesKey = "..." }) or the EasyAdmin__AesKey environment variable. Note that changing the key invalidates all existing logins — users must sign in again

  • v2.7.0 base tables gain a TenantCode column and unique indexes become composite (breaking change, database migration required): Core tables such as SysUser, SysLoginLog, SysConfig, SysDict, SysPrintTemplate, SysFile, SysMessage / SysMessageUser, SysOperationLog, SysOrg, SysRole / SysRoleUser / SysRoleMenu / SysFavoriteUser, plus the six CMS tables and SysApprovalRecord, gain string TenantCode (varchar(50)) and implement ITenantEntity. SysLog already had a nullable column; it is now non-nullable and implements the interface. The four indexes uk_username / uk_code / uk_name / uk_print_template_name keep their names but their unique key changes from one column to (TenantCode, original column) (so identical usernames/codes no longer collide in a shared database). The column is added to the schema even without multi-tenancy — the AOP fills it with main on write — but no row filter is installed on the main / dedicated databases, so query behavior is unchanged.

    • Production databases need a manual migration: where UseAutoSyncStructure is disabled (the Demo disables it outside Development), run ALTER TABLE ... ADD COLUMN TenantCode VARCHAR(50) NOT NULL DEFAULT 'main'; for each table above before upgrading, then drop each old same-named index and recreate it as a composite unique index (SQLite index names are database-wide, so dropping first is required or you get index ... already exists). With auto-sync enabled, columns and indexes are only synchronized on the first write to that table, and rebuilding an index on a large table can lock it — verify in a development / test database first.
    • Legacy rows are not backfilled: their TenantCode is NULL or empty and the framework does not fill them in. Single-database / dedicated mode and the platform's main database both allow NULL (the startup configuration reader and the main filter handle it), so they are unaffected. If you plan to enable shared databases, the exact-match filter there does not admit NULL — backfill those rows with main or the appropriate tenant code before switching, otherwise the platform sees them while tenants do not.
    • Review business code: code that enumerates entity columns via reflection, de-duplicates by unique key, or builds import templates must exclude TenantCode or switch to the composite key — see AdminTable.ImportWriter.cs / AdminTable.Permissions.cs for the framework's own approach. New APIs include ITenantEntity, TenantRuntime.CurrentCode, TenantScopeKind and TenantEntityRegistry (AdminContext.MainTenantCode is not new).
  • v2.7.0 IConfigSettingsContributor merged into GetSettingFields() (breaking change): the dictionary version GetConfigSettings() is deleted; third-party contributors should implement GetSettingFields() returning a list of ConfigSettingField (code / display name / control type / options / remark) — both settings-page rendering and database seeding now use that single list

  • v2.7.0 new SMS and access-gate extensions: EasyAdminBlazor.Sms aggregates Aliyun / Tencent Cloud / SendCloud SMS, and the old EasyAdminBlazor.AliyunSms is no longer maintained (new projects should switch to Sms and change config from AliyunSms:* to Sms:*). EasyAdminBlazor.BotGuard is an access gate that is off by default and must be mounted explicitly by the host after UseForwardedHeaders and UseAuthentication via app.UseEasyAdminBlazorBotGuard(); when disabled, behavior is byte-for-byte unchanged. See SMS extension and Human Verification and Access Gate

  • v2.7.0 the CMS extension removes the bilingual fields (breaking change): the CMS package version goes to 2.7.0 with this release (the last published one was 2.5.1), and CmsData.TitleEn / ContentEn, CmsCategory.NameEn, CmsElement.ContentEn, plus the CmsItemView.TitleEn / ContentEn and CmsItemSave.TitleEn / ContentEn members that existed only to carry them, are all gone. Those members exist in 2.5.1, so code referencing them no longer compiles after the upgrade. Front-end templates never read *En and need no change; sites with custom code reading these fields have to move to the three translation tables cms_data_lang / cms_category_lang / cms_element_lang (with EasyAdminBlazor.MultiLang installed, the edit dialog's language tabs are the new place to enter them). The hardwired English values are not migrated and have to be re-entered once; the old database columns are not dropped automatically, they stay inert and can be cleaned up by hand

  • v2.7.0 the data-localization extension is provided for the first time: EasyAdminBlazor.MultiLang arrives with this version, not on the public NuGet feed — included for paid source-code licensees, so there is no earlier version to upgrade from. "The translation entity must implement the main package's IDataLangEntity" is the shape it has from day one -- implement the interface as data localization describes when writing the first translation class

  • v2.7.0 the AI extension is provided for the first time: EasyAdminBlazor.AI is likewise not on the public NuGet feed and is included for paid source-code licensees; chain AddEasyAdminBlazorAI() after AddEasyAdminBlazor, and maintain model connections in the back office "AI Model Management" page

  • v2.7.0 multi-tenant plans (breaking: the tenant ↔ menu link is removed): a tenant's feature scope is now decided only by its plan — new SysPlan + SysPlanMenu (a plan ticks menus; lives in the main database), and SysTenant gains PlanId / ExpireAt / UserLimit. Saving a tenant copies the plan's menus into the sys_menu of a dedicated-tenant database (ancestors completed, host-only menus dropped, each provisioned menu bringing its button rows along); shared tenants keep a single menu catalogue in the main database. Runtime authorization reads the current tenant data source, exactly as before the upgrade. The old "menus the tenant ticked itself" link in the main database is therefore gone entirely: the SysTenantMenu type plus SysTenant.Menus and SysMenu.Tenants no longer exist, and code referencing them will not compile after the upgrade. The framework repository itself (main package / Core / every extension / Demo / tests) was checked and keeps no reference. Migration: give the tenant a plan, or read SysPlanMenu from EasyAdminBlazor.MultiTenant. Visible UI changes — the tenant edit dialog's "Function Menu" tab is now a read-only view of the plan, the plan becomes required (main excepted, left disabled), and saving is rejected when no plan is selected, the plan no longer exists, or the plan contains no menus at all. No data is destroyed: the SysTenantMenu table in existing databases is not dropped automatically and is simply ignored (its name matches the old entity; run DROP TABLE "SysTenantMenu"; yourself if you want it gone); existing tenants keep PlanId = 0 and their tenant databases keep their menus untouched — a plan only has to be chosen the next time such a tenant is edited and saved (a brand-new database ships a "标准版" / Standard plan covering every assignable menu as a fallback). The expiry date blocks new logins only and never evicts live sessions; the user limit is enforced both when adding a user and when importing users, where blank or 0 means unlimited

  • v2.7.0 tenant databases: button rows and baseline data: two behaviour changes to be aware of. (1) Provisioning a tenant now copies button rows along with the menus (they used to be stripped wholesale), because button permissions for non-administrator roles are read from those Type=Button rows in the current tenant data source. Existing dedicated-tenant databases are not patched automatically — the rows appear the next time that tenant is edited and saved (nothing fails if you never re-save; only the administrator's built-in bypass works in that tenant). (2) A new ITenantInitializer hook: the startup IExtensionInitializer only ever ran against the main database, so a tenant database created later was never written at all (a new tenant saw empty dropdowns and lists while extension tables were created lazily on first query). Hosts and extensions register their own implementations; the framework ships none — with nothing registered the behaviour is unchanged, and registered implementations only run when a tenant is created

  • Template behind the core package: EasyAdminBlazor.Templates and EasyAdminBlazor may not be in sync; upgrade the core package to the latest after creating a project from the template

  • Multiple instances: roll upgrades instance by instance to avoid a full service interruption