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
- Clean the
binandobjdirectories (stale build artifacts can interfere) - Rebuild:
dotnet build - Start on a development environment with
UseAutoSyncStructure(true)and confirm new tables/columns are synced - Check the changelog for breaking changes (renamed settings, API changes, changed defaults)
- Walk through the key features: login, user/role/menu, operation logs, file upload, code generator
- 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 behaviourv2.3.2 operation log gains two columns:
SysOperationLogaddsEntityType,EntityKeyand theidx_operationlog_entityindex (used by the change-history view). WithUseAutoSyncStructure(true)they are created automatically; when auto-sync is disabled in production, run the equivalentALTER TABLE ... ADD COLUMN ...andCREATE INDEX ...manuallyv2.6.0 the controlled download of private files has been removed (breaking change): the
/api/files/{id}endpoint and theFileService.OpenPrivateFileAsyncmethod are gone; files are served from their static URL. If your own code references any of these members, switch toSysFile.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. TheSysFile.IsPublicfield 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 changev2.6.0 approval record gains one column:
SysApprovalRecordaddsTotalLevels(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 runsCodeFirst.SyncStructure<SysApprovalRecord>()on startup and adds the column automatically; when auto-sync is disabled in production, runALTER 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 upgradev2.6.0 image pixel limit: a new
FileSettings:MaxImagePixelssetting (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 to0to 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 attributev2.7.0
AesKeyis now required (breaking change):EasyAdminBlazorOptions.AesKeyno longer has a built-in default (the oldEasyAdminBlazorKey!is gone); encryption/decryption of sensitive fields throws immediately when it is missing. Supply it before upgrading inAddEasyAdminBlazor(new EasyAdminBlazorOptions { AesKey = "..." })or theEasyAdmin__AesKeyenvironment variable. Note that changing the key invalidates all existing logins — users must sign in againv2.7.0 base tables gain a
TenantCodecolumn and unique indexes become composite (breaking change, database migration required): Core tables such asSysUser,SysLoginLog,SysConfig,SysDict,SysPrintTemplate,SysFile,SysMessage/SysMessageUser,SysOperationLog,SysOrg,SysRole/SysRoleUser/SysRoleMenu/SysFavoriteUser, plus the six CMS tables andSysApprovalRecord, gainstring TenantCode(varchar(50)) and implementITenantEntity.SysLogalready had a nullable column; it is now non-nullable and implements the interface. The four indexesuk_username/uk_code/uk_name/uk_print_template_namekeep 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 withmainon write — but no row filter is installed on the main / dedicated databases, so query behavior is unchanged.- Production databases need a manual migration: where
UseAutoSyncStructureis disabled (the Demo disables it outside Development), runALTER 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 getindex ... 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
TenantCodeis 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 themainfilter 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 withmainor 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
TenantCodeor switch to the composite key — seeAdminTable.ImportWriter.cs/AdminTable.Permissions.csfor the framework's own approach. New APIs includeITenantEntity,TenantRuntime.CurrentCode,TenantScopeKindandTenantEntityRegistry(AdminContext.MainTenantCodeis not new).
- Production databases need a manual migration: where
v2.7.0
IConfigSettingsContributormerged intoGetSettingFields()(breaking change): the dictionary versionGetConfigSettings()is deleted; third-party contributors should implementGetSettingFields()returning a list ofConfigSettingField(code / display name / control type / options / remark) — both settings-page rendering and database seeding now use that single listv2.7.0 new SMS and access-gate extensions:
EasyAdminBlazor.Smsaggregates Aliyun / Tencent Cloud / SendCloud SMS, and the oldEasyAdminBlazor.AliyunSmsis no longer maintained (new projects should switch to Sms and change config fromAliyunSms:*toSms:*).EasyAdminBlazor.BotGuardis an access gate that is off by default and must be mounted explicitly by the host afterUseForwardedHeadersandUseAuthenticationviaapp.UseEasyAdminBlazorBotGuard(); when disabled, behavior is byte-for-byte unchanged. See SMS extension and Human Verification and Access Gatev2.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 theCmsItemView.TitleEn/ContentEnandCmsItemSave.TitleEn/ContentEnmembers 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*Enand need no change; sites with custom code reading these fields have to move to the three translation tablescms_data_lang/cms_category_lang/cms_element_lang(withEasyAdminBlazor.MultiLanginstalled, 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 handv2.7.0 the data-localization extension is provided for the first time:
EasyAdminBlazor.MultiLangarrives 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'sIDataLangEntity" is the shape it has from day one -- implement the interface as data localization describes when writing the first translation classv2.7.0 the AI extension is provided for the first time:
EasyAdminBlazor.AIis likewise not on the public NuGet feed and is included for paid source-code licensees; chainAddEasyAdminBlazorAI()afterAddEasyAdminBlazor, and maintain model connections in the back office "AI Model Management" pagev2.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), andSysTenantgainsPlanId/ExpireAt/UserLimit. Saving a tenant copies the plan's menus into thesys_menuof 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: theSysTenantMenutype plusSysTenant.MenusandSysMenu.Tenantsno 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 readSysPlanMenufromEasyAdminBlazor.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 (mainexcepted, 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: theSysTenantMenutable in existing databases is not dropped automatically and is simply ignored (its name matches the old entity; runDROP TABLE "SysTenantMenu";yourself if you want it gone); existing tenants keepPlanId = 0and 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 unlimitedv2.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=Buttonrows 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 newITenantInitializerhook: the startupIExtensionInitializeronly 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 createdTemplate behind the core package:
EasyAdminBlazor.TemplatesandEasyAdminBlazormay not be in sync; upgrade the core package to the latest after creating a project from the templateMultiple instances: roll upgrades instance by instance to avoid a full service interruption