Extensions
EasyAdminBlazor decouples core functionality from extensions: install only the NuGet packages you need. Below is the installation, registration and basic usage of each extension.
Build Your Own Extension
Official extensions (Approval, Print, Scheduled Tasks, Multi-Tenant, WeChat, …) all follow the same pattern: a standalone class library + an AddEasyAdminBlazorXxx() registration method. One line in the host installs it, and if you don't reference it, it simply doesn't exist. To package your own feature the same way, see How to Build Your Own Extension for the full walkthrough.
Extension Overview
| Package | Registration | Feature |
|---|---|---|
EasyAdminBlazor.Mail |
AddEasyAdminBlazorMail() |
SMTP / SendCloud email |
EasyAdminBlazor.AliyunSms |
AddEasyAdminBlazorAliyunSms() |
Aliyun SMS |
EasyAdminBlazor.Redis |
AddEasyAdminBlazorRedis(connectionString) |
Redis cache, online status, pub/sub, distributed locks |
EasyAdminBlazor.FusionCache |
AddEasyAdminBlazorFusionCache() |
Hybrid cache acceleration |
EasyAdminBlazor.Captcha |
AddEasyAdminBlazorCaptcha(options) |
Form/login captcha |
EasyAdminBlazor.HtmlEditor |
AddEasyAdminBlazorTinyMCEEditor() |
TinyMCE rich text editor |
EasyAdminBlazor.Chat |
AddEasyAdminBlazorChat() + app.UseChat() |
Real-time chat (requires Redis) |
EasyAdminBlazor.MultiTenant |
AddEasyAdminBlazorMultiTenant() |
Multi-tenant, see Multi-Tenant |
EasyAdminBlazor.Scheduler |
AddEasyAdminBlazorScheduler() |
Scheduled tasks, see Scheduled Tasks |
EasyAdminBlazor.WeChat |
AddEasyAdminBlazorWeChat() |
WeChat Mini Program & WeChat Pay V3 |
EasyAdminBlazor.Approval |
AddEasyAdminBlazorApproval() |
Lightweight multi-level approval (state machine + approval record table), see Approval |
EasyAdminBlazor.Print |
AddEasyAdminBlazorPrint() |
Print templates & report designer, see Print Template |
EasyAdminBlazor.CodeGenerator |
AddEasyAdminBlazorCodeGenerator() |
Visual CRUD code generator, see Code Generator |
EasyAdminBlazor.Upgrade |
AddEasyAdminBlazorUpgrade() |
Application online upgrade (per-version deltas, packages built on publish), see Application Upgrade |
EasyAdminBlazor.Cms |
AddEasyAdminBlazorCms() |
Content management: content, categories, page elements and SEO. See Build a CMS Module |
Register them all in Program.cs:
builder.AddEasyAdminBlazor(new EasyAdminBlazorOptions { ... })
.AddEasyAdminBlazorMail()
.AddEasyAdminBlazorRedis(configuration["Redis:ConnectionString"]!)
.AddEasyAdminBlazorChat()
.AddEasyAdminBlazorScheduler()
.AddEasyAdminBlazorCaptcha(options => { options.Chars = "0123456789"; })
.AddEasyAdminBlazorCms();
Redis (EasyAdminBlazor.Redis)
.AddEasyAdminBlazorRedis(configuration["Redis:ConnectionString"]!)
Configuration:
{
"Redis": {
"ConnectionString": "127.0.0.1:6379,poolsize=10"
}
}
Inject IRedisService after registration:
- General cache:
Get<T>/Set<T>/IncrBy/Expire, plus String, Hash, List, Set, and Sorted Set operations - Online status:
JoinOnline/RemoveOnline/GetClientListByOnline/HasOnline - Pub/Sub:
Publish/Subscribe(channels from theSubscribeChannelenum) - Distributed locks:
Lock(key, expireSeconds)/ReleaseLock(lockHandle)
@inject IRedisService Redis
// Cache
Redis.Set("user:1", new UserDto { ... }, TimeSpan.FromMinutes(10));
var user = Redis.Get<UserDto>("user:1");
// Pub/Sub
Redis.Subscribe<MyMessage>(SubscribeChannel.MessageNotification, msg =>
{
// handle the message
});
Redis.Publish(SubscribeChannel.MessageNotification, new MyMessage { ... });
// Distributed lock
var lockHandle = Redis.Lock("order:100", 30);
try
{
// critical section
}
finally
{
Redis.ReleaseLock(lockHandle);
}
The extension also provides an IDistributedCache implementation compatible with the standard distributed cache interface.
Mail (EasyAdminBlazor.Mail)
.AddEasyAdminBlazorMail()
Configuration supports two layouts. The recommended one groups providers under Mail (configure one of the three; SMTP cannot send template emails):
{
"Mail": {
"Provider": "TencentCloud",
"Smtp": {
"Server": "smtp.example.com",
"Port": 587,
"Username": "your_email@example.com",
"Password": "your_email_password",
"FromEmail": "your_email@example.com",
"EnableSsl": true
},
"SendCloud": {
"ApiUser": "your_sendcloud_api_user",
"ApiKey": "your_sendcloud_api_key",
"SenderEmail": "noreply@example.com",
"SenderName": "Your App"
},
"TencentCloud": {
"SecretId": "your_secret_id",
"SecretKey": "your_secret_key",
"Region": "ap-guangzhou",
"FromEmail": "noreply@example.com",
"FromName": "Your App",
"ReplyToAddresses": ""
}
}
}
The legacy top-level layout (SmtpSettings / SendCloud / TencentCloud) is still supported:
{
"SmtpSettings": {
"Server": "smtp.example.com",
"Port": 587,
"Username": "your_email@example.com",
"Password": "your_email_password",
"FromEmail": "your_email@example.com",
"EnableSsl": true
}
}
The two layouts can be mixed: a non-empty legacy key wins, and the value under Mail is used otherwise.
The admin "System Settings" page writes the legacy keys, so edits made there always take effect. Once a key has been saved in the admin page, a value under Mail in appsettings will not override it (clear the admin value to fall back to appsettings).
Provider accepts Smtp / SendCloud / TencentCloud; when omitted, Auto picks SendCloud first, then Tencent Cloud, then SMTP.
With an explicit Provider, the admin settings page only shows that provider's fields; with Auto, all three groups are shown.
Inject IEmailService:
@inject IEmailService EmailService
// Plain email; separate multiple recipients with semicolons; isHtml controls the body format
var ok = await EmailService.SendEmailAsync("a@example.com;b@example.com", "Subject", "<h1>Body</h1>", isHtml: true);
// Template email (SendCloud templates)
var (success, message) = await EmailService.SendTemplateEmailAsync(
"a@example.com",
"Notification",
"your_template_name",
new Dictionary<string, object> { ["code"] = "1234" });
SMS (EasyAdminBlazor.AliyunSms)
.AddEasyAdminBlazorAliyunSms()
Configuration:
{
"AliyunSms": {
"AccessKeyId": "your_access_key_id",
"AccessKeySecret": "your_access_key_secret",
"SignName": "your_sign_name"
}
}
Inject ISmsService:
@inject ISmsService SmsService
var ok = await SmsService.SendSmsAsync("13800000000", "SMS_123456", "{\"code\":\"1234\"}");
Captcha (EasyAdminBlazor.Captcha)
.AddEasyAdminBlazorCaptcha(options =>
{
options.Chars = "0123456789";
})
The login captcha is controlled by EasyAdminBlazorOptions.EnableLoginCaptcha. The character set, length, etc. are configured through CaptchaOptions.
Rich Text Editor (EasyAdminBlazor.HtmlEditor)
.AddEasyAdminBlazorTinyMCEEditor()
Configure the script URL (a self-hosted CDN or a local copy works):
{
"TinyMCE": {
"ScriptSrc": "https://cdn.wang-zhan.cn/tinymce_8.3.2/tinymce.min.js"
}
}
Use the AdminEditor component in pages (see the component docs).
Real-Time Chat (EasyAdminBlazor.Chat)
.AddEasyAdminBlazorChat()
// ...
app.UseChat();
Depends on Redis: register the Redis extension before AddEasyAdminBlazorChat(); chat stays disabled when Redis is not configured. See Online Chat for UI usage.
Multi-Tenant (EasyAdminBlazor.MultiTenant)
.AddEasyAdminBlazorMultiTenant()
Separate databases per tenant, domain-based tenant resolution, menu and file isolation. See Multi-Tenant for full details.
Scheduled Tasks (EasyAdminBlazor.Scheduler)
.AddEasyAdminBlazorScheduler()
Supports the [Scheduler] attribute and dynamic management via ISchedulerService, with a management page at /Admin/TaskScheduler. See Scheduled Tasks for full details.
Print Templates (EasyAdminBlazor.Print)
<!-- NuGet -->
<PackageReference Include="EasyAdminBlazor.Print" Version="2.4.0" />
builder.AddEasyAdminBlazor(new EasyAdminBlazorOptions { ... })
// …your existing extension chain…
.AddEasyAdminBlazorPrint(); // enables print templates and the report designer
Without this extension the framework ships no print pages and no print implementation. Once referenced, a
"Print Template" menu item appears in the system menu (/Admin/PrintTemplate), and every AdminTable toolbar
gains a print button. Designed templates can be printed from a list or detail page in one click, or invoked from any
component by injecting PrintService. See Print Templates for the full guide.
Content Management (EasyAdminBlazor.Cms)
EasyAdminBlazor.Cmsis a front-end development accelerator for developers. Build pages in Razor and declare their content model with[CmsPage]/[CmsDataType]; the extension generates the admin content management UI, so editors can manage content, categories, page elements, SEO and comment moderation without changing code.
<!-- NuGet -->
<PackageReference Include="EasyAdminBlazor.Cms" Version="2.5.0" />
// Program.cs: add it to the EasyAdminBlazor extension chain
builder.AddEasyAdminBlazor(new EasyAdminBlazorOptions { ... })
// ... your existing extensions ...
.AddEasyAdminBlazorCms();
In the host's root component (usually Components/App.razor), reference the Live Edit script at the end of <body>, after blazor.web.js:
<script src="@Assets["_content/EasyAdminBlazor.Cms/cms-inline-edit.js"]"></script>
The CMS extension manages content, categories, page elements and page SEO by content type, and creates the admin entry automatically:
- Data:
/Admin/CmsManage/{ContentType}with create, edit, delete, paging, category filtering and custom fields - Categories: the Categories tab on
/Admin/CmsManage/{ContentType} - Elements: the Elements tab, with in-page editing once the script above is referenced
- SEO: the SEO tab
Declare a Razor PageModel with [CmsPage] to define the page, content type and custom fields. At startup the CMS extension synchronizes the cms_data, cms_category, cms_field, cms_element and cms_page_seo table structures, then generates the admin menus and buttons. Read front-end data through ICmsContentService and mark editable regions with <vc:textblock>.
Comments are optional and disabled by default. .AddEasyAdminBlazorCms(o => o.EnableComments = true) is what creates the cms_comment table, adds the "Comment Review" admin menu and lets ICmsCommentService.AddAsync accept submissions. When it is off, the "Comment Review" menu is hidden automatically — existing menu rows and comments are never deleted, and re-enabling brings them back.
For data that has no separate public page, use [CmsDataType]; its admin path is /Admin/CmsData/{ContentType}.
For page definitions, custom fields, front-end queries, element markers and Live Edit, see Build a Module with EasyAdminBlazor.Cms.
Application Online Upgrade (EasyAdminBlazor.Upgrade)
<!-- NuGet (recommended) -->
<PackageReference Include="EasyAdminBlazor.Upgrade" Version="2.4.0" />
builder.AddEasyAdminBlazor(new EasyAdminBlazorOptions { ... })
// …your existing extension chain…
.AddEasyAdminBlazorUpgrade(); // footer gains "Check for updates"; /health is mounted by the extension
"Upgrade": {
"Enabled": true,
"Source": "Local", // Local release folder / Url release index
"ReleasesPath": "updates",
"RestartMode": "WindowsService", // WindowsService / Systemd / Direct (BT panel, self-hosting)
"ServiceName": "your-service-name",
"HealthCheckUrl": "http://127.0.0.1:5000"
}
Without this extension there is no upgrade capability at all (no footer entry, no /health, no package generated on publish),
so existing applications behave exactly as before. A Release publish automatically produces updates/v<version>/update.zip;
copy the new version folder plus index.json into the server's updates/, then an administrator clicks
“Check for updates → Upgrade now” in the admin UI. Failed steps are rolled back and users do not have to log in again.
On Windows it must run as a Windows service (Kestrel + IIS reverse proxy); in-process IIS hosting disables the feature.
See Application Upgrade for the full guide.
Approval (EasyAdminBlazor.Approval)
.AddEasyAdminBlazorApproval(o =>
{
o.Flows.Add(new ApprovalFlowConfig
{
BillType = typeof(Article).FullName!,
Levels =
[
new ApprovalLevelConfig { Level = 1, Name = "Department manager", Kind = ApproverKind.OrgLeader, Offset = 1 },
new ApprovalLevelConfig { Level = 2, Name = "Finance review", Kind = ApproverKind.Role, Value = "Finance" }
]
});
})
Change a business entity's base class to ApprovalEntity / ApprovalEntityFull (or implement IApprovalBill directly) and it is under approval: AdminTable submits automatically after saving and blocks edits while pending, and the approval record table doubles as the to-do index.
For fixed two/three level approval flows this is much lighter than a workflow engine. See Approval for full details.
Hybrid Cache (EasyAdminBlazor.FusionCache)
.AddEasyAdminBlazorFusionCache()
Implements ICacheService with FusionCache for hybrid in-memory/Redis caching.
WeChat (EasyAdminBlazor.WeChat)
.AddEasyAdminBlazorWeChat()
Configuration:
{
"Wechat": {
"App": {
"AppKey": "your_app_key",
"AppSecret": "your_app_secret"
},
"PayV3": {
"AppId": "",
"MchId": "",
"ApiV3Key": "",
"CertificatePath": "certs/apiclient_cert.pem",
"KeyPath": "certs/apiclient_key.pem",
"PubPath": "certs/pub_key.pem",
"NotifyUrl": "",
"BaseUrl": "https://api.mch.weixin.qq.com"
}
}
}
Main services:
WeChatAppService: Mini Program login (code → openid/session_key), signature validation/decryption of user data, Mini Program QR code generationWeChatPayV3Service: Native / JSAPI payment, callback verification & decryption, order query/close
@inject WeChatPayV3Service WeChatPay
// Create a Native (PC scan-to-pay) order
var result = await WeChatPay.CreateNativePaymentAsync("Product description", 0.01m, outTradeNo);
if (result.Success)
{
// result.CodeUrl is used to generate the QR code
}
Notes
- Keep extension packages at the same version as the core package
- Do not install extensions you do not use — it avoids bloat and potential conflicts
- Do not commit WeChat Pay certificate files (
certs/) to the repository