0
我需要使用查詢表達式來提取插件DLL。我知道我可以使用數據庫,並可以從「PluginAssemblyBase」表和「內容」列中提取它。無論如何,我可以使用查詢表達式來提取它嗎?如何使用動態CRM中的查詢表達式提取插件DLL
我需要使用查詢表達式來提取插件DLL。我知道我可以使用數據庫,並可以從「PluginAssemblyBase」表和「內容」列中提取它。無論如何,我可以使用查詢表達式來提取它嗎?如何使用動態CRM中的查詢表達式提取插件DLL
您必須獲取'content'屬性並使用'FromBase64String'方法來獲取原始字節。
String connectionString = @"AuthType=AD;Url=http://xyz/CRO; Domain=DEVDOMAIN; Username=user01; Password=12345";
CrmServiceClient conn = new CrmServiceClient(connectionString);
IOrganizationService orgService = conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;
QueryExpression qExpr = new QueryExpression("pluginassembly") { ColumnSet = new ColumnSet(new string[] { "pluginassemblyid", "content" }) };
qExpr.Criteria.AddCondition("name", ConditionOperator.Equal, "YourAssemblyName");
EntityCollection entColl = orgService.RetrieveMultiple(qExpr);
Byte[] data = Convert.FromBase64String((String)entColl[0]["content"]);
有什麼辦法將這個字節數據轉換成C#中的可讀源代碼? 我想在文本文件/ mutliline文本框中顯示源代碼 –
將它保存到文件並使用C#反編譯器,如ILSpy或JustDecompile – pen2
文件將是txt擴展名文件。 這些反編譯器是否接受文本文件或只是dll? –