惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
H
Help Net Security
GbyAI
GbyAI
博客园_首页
G
Google Developers Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
月光博客
月光博客
美团技术团队
B
Blog RSS Feed
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园 - 叶小钗
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Proofpoint News Feed

Donghai's Blog

使用DBeaver连接Dynamics 365 Dataverse | Donghai C# 技术备忘 - LINQ | Donghai 为Astro站点添加Google Analytics | Donghai C# 技术备忘 - LINQ - Donghai’s Blog 20260819 说些什么 | Donghai Dynamics 365 interview questions | Donghai C# 技术备忘 (1) | Donghai Dynamics 365 事件框架、事件执行管道 | Donghai 马拉松配速表 | Donghai 马拉松赛事分级 | Donghai 抖音创作日志(2026年) | Donghai 2026年跑步日志(5月开始) | Donghai 2FA | Donghai 初尝Github Actions | Donghai AstroPaper主题添加Waline评论 | Donghai Dynamics 365集中视图/聚焦视图/Focused View | Donghai AstroPaper主题添加GitHub风格的Markdown警告框 | Donghai AstroPaper主题自定义记录 | Donghai 我日常收藏的优质网站资源导航(持续更新) | Donghai 如何从归档页批量获取URL并提交到Bing Webmaster Tools | Donghai PaperMod 使用 Zeoseven 自定义网页字体 | Donghai 我常用的Prompt | Donghai Hugo默认时区导致本地预览文章不显示 | Donghai 通过手动提交工单解决Bing不收录网站问题 | Donghai 如何访问 Power BI 管理门户(Power BI Admin Portal) | Donghai 还在手敲时间戳?Win11输入法一个技巧,秒输当前时间戳 | Donghai 工作术语备忘录(持续更新) | Donghai 使用XrmToolBox导出安全角色表级权限到Excel | Donghai 24年的年终总结 | Donghai World笔记 | Donghai
我常用的插件注释模板(Dynamics 365) | Donghai
Donghai · 2022-02-16 · via Donghai's Blog

在 Dynamics 365 项目中,插件往往是业务逻辑最集中、最容易踩坑的地方。当项目周期拉长、人员更替或多人并行开发时,如果缺少清晰、统一的插件注释,维护成本会迅速放大

下面整理的是我在多个 Dynamics 365 项目中反复使用的插件注释模板,目标只有一个:让后来的人在不翻代码、不查注册记录的情况下,也能快速理解这个插件在 “什么时候、对什么、做了什么”

Table of contents

Open Table of contents
  • 插件注释模板示例
  • 说明
  • Message/State/Mode 常见取值
  • 完整插件示例

插件注释模板示例

/// <summary>
/// <list type="bullet">
/// <item>模块:售前(示例)</item>
/// <item>功能</item>
/// <list type="number">
/// <item>功能描述 xxxx xxxx xxxx</item>
/// <item>功能描述 xxxx xxxx xxxx</item>
/// </list>
/// <item>Primary Entity: Lead</item>
/// <item>Message: Update</item>
/// <item>Update Attributes: qualifyingopportunityid, statecode</item>
/// <item>State: PostOperation</item>
/// <item>Mode: Synchronous</item>
/// </list>
/// </summary>

说明

  • 模块 + 功能描述:从业务角度快速定位用途
  • Primary Entity / Message / Stage / Mode:与插件注册信息一一对应
  • Update Attributes:明确触发条件,避免“为什么会执行”的疑问

这套结构在代码审查、问题排查、插件迁移时都非常实用

Message/State/Mode 常见取值

Message 1 Create
2Update
3Delete
4Associate
5Disassociate
6SetStateDynamicEntity
7RetrieveMultiple
8Retrieve
9QualifyLead
10Assign
State
执行阶段
1 Pre-validation
2Pre-operation
3Post-operation
Mode
执行模式
1 Synchronous
2Asynchronous

完整插件示例

using Microsoft.Xrm.Sdk;
using System;
namespace Blog.D365.Plugins.Account
{
    /// <summary>
    /// <list type="bullet">
    /// <item>模块:售前(示例)</item>
    /// <item>功能</item>
    /// <list type="number">
    /// <item>功能描述 xxxx xxxx xxxx</item>
    /// <item>功能描述 xxxx xxxx xxxx</item>
    /// </list>
    /// <item>Primary Entity: Lead</item>
    /// <item>Message: Update</item>
    /// <item>Update Attributes: qualifyingopportunityid, statecode</item>
    /// <item>State: PostOperation</item>
    /// <item>Mode: Synchronous</item>
    /// </list>
    /// </summary>
    public class AccountPostUpdate : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            // 此处代码省略
        }
    }
}

(完)

如果这篇文章刚好帮到了你,欢迎请我喝杯咖啡