我正在爲Dynamics CRM(2015和CRM Online)定製C#插件進行插件註冊。Dynamics CRM插件註冊爲「post operation」在數據庫事務內部還是外部運行?
當您創建使用Visual Studio CRM Explorer的一個新的插件,你得到標準的「創建插件」對話框:
在「流水線階段」,有三個選項:
- 預驗證
- 操作前
- 後操作
在此處選擇Post-Operation
導致這段代碼被添加到XML註冊文件:
<Plugin Description="..." FriendlyName="PostContactCreate" Name="Cacheron.PostContactCreate" Id="00000000-0000-0000-0000-000000000000" TypeName="Cacheron.PostContactCreate">
<Steps>
<clear />
<Step CustomConfiguration="" Name="PostContactCreate" Description="Post-Operation of Contact Create" Id="00000000-0000-0000-0000-000000000000" MessageName="Create" Mode="Synchronous" PrimaryEntityName="contact" Rank="1" SecureConfiguration="" Stage="PostOutsideTransaction" SupportedDeployment="ServerOnly">
<Images />
</Step>
</Steps>
</Plugin>
的關鍵部分存在着中間線,在那裏它說系統產生Stage="PostOutsideTransaction"
相應的C#代碼由該工具包含的行:
base.RegisteredEvents.Add(
new Tuple<int, string, string, Action<LocalPluginContext>>(
40,
"Create",
"contact",
new Action<LocalPluginContext>(ExecutePostContactCreate)
)
);
該插件註冊中的幻數40看來,以對應於https://msdn.microsoft.com/en-gb/library/gg327941.aspx記錄的「管道階段」,它說
事件後
手術後
階段在流水線的插件,這是在主操作之後執行。在這個階段註冊的插件在數據庫事務中執行。
由工具,清清楚楚地寫着生成所以我已經有了註冊XML通過相同的工具,它指定舞臺40,這是產生PostOutsideTransaction,和C#代碼「的數據庫事務中執行」
那它是哪一個? XML註冊語法是否使用誤導性名稱,或者這是插件創建工具中的錯誤,還是執行管道做了一些我不明白的事情?
你有鏈接或文件,說明檢索不在數據庫事務中嗎? – Daryl