我常用的插件注释模板(Dynamics 365)
442 字
2 分钟
我常用的插件注释模板(Dynamics 365)
在 Dynamics 365 项目中,插件往往是业务逻辑最集中、最容易踩坑的地方。当项目周期拉长、人员更替或多人并行开发时,如果缺少清晰、统一的插件注释,维护成本会迅速放大
下面整理的是我在多个 Dynamics 365 项目中反复使用的插件注释模板,目标只有一个:让后来的人在不翻代码、不查注册记录的情况下,也能快速理解这个插件在 “什么时候、对什么、做了什么”
插件注释模板示例
/// <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 |
| 2 | Update | |
| 3 | Delete | |
| 4 | Associate | |
| 5 | Disassociate | |
| 6 | SetStateDynamicEntity | |
| 7 | RetrieveMultiple | |
| 8 | Retrieve | |
| 9 | QualifyLead | |
| 10 | Assign | |
| State 执行阶段 |
1 | Pre-validation |
| 2 | Pre-operation | |
| 3 | Post-operation | |
| Mode 执行模式 |
1 | Synchronous |
| 2 | Asynchronous |
完整插件示例
using Microsoft.Xrm.Sdk;using System;namespace Blog.D365.Plugins.Account{ // [!code ++:15] /// <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) { // 此处代码省略 } }}(完)
支持与分享
如果这篇文章对你有帮助,欢迎分享给更多人或打赏支持!
我常用的插件注释模板(Dynamics 365)
https://mgrowup.com/posts/dynamics365/plugin-comment-template/相关文章智能推荐
1
Dynamics 365 事件框架、事件执行管道
Dynamics 365Dynamics 365 插件运行的“流水线”到底长什么样?
2
Plugin Registration Tool安装指南
Dynamics 365详细介绍Dynamics 365 Plugin Registration Tool的两种安装方式,直接下载安装包与 PowerShell脚本自动化安装
3
Dynamics 365项目中常用的SQL语句(持续更新)
Dynamics 365本文针对Dynamics 365的日常运维和管理需求,整理些实用的SQL查询脚本
4
Dynamics 365 SSRS导出PDF
Dynamics 365通过自定义JavaScript按钮调用现有报表,绕过标准“另存为”的多格式限制,实现一键导出PDF
5
(记录)Dynamics 365标准实体的状态选项及对应的状态描述状态码
Dynamics 365记录Dynamics 365标准实体的状态选项与相应的状态原因代码
随机文章随机推荐
