-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD Добавлены методы для работы с метаданными списков.
UPD Обновлена документация.
- Loading branch information
Showing
69 changed files
with
203 additions
and
99 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Source/PZone.Xrm/IOrganizationServiceMetadataExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.Linq; | ||
using Microsoft.Xrm.Sdk; | ||
using Microsoft.Xrm.Sdk.Messages; | ||
using Microsoft.Xrm.Sdk.Metadata; | ||
|
||
namespace PZone.Xrm | ||
{ | ||
/// <summary> | ||
/// Набор методов для упрощения работы с метаданными. | ||
/// </summary> | ||
// ReSharper disable once UnusedMember.Global | ||
// ReSharper disable once InconsistentNaming | ||
public static class IOrganizationServiceMetadataExtensions | ||
{ | ||
/// <summary> | ||
/// Получение метки элемента списка значений. | ||
/// </summary> | ||
/// <param name="service">Экземпляр сервиса CRM.</param> | ||
/// <param name="entityName">Системное имя сущности.</param> | ||
/// <param name="attributeName">Системное имя атрибута сущности типа "Список значений" (Picklist).</param> | ||
/// <param name="value">Числовое значение элемента списка.</param> | ||
/// <returns> | ||
/// Метод возвращает локальную метку элемента списка значений. | ||
/// </returns> | ||
/// <exception cref="ArgumentOutOfRangeException">В метаданных списка нет указанного в <paramref name="value"/> значения.</exception> | ||
/// <exception cref="InvalidPluginExecutionException">Неизвестная ошибка.</exception> | ||
public static string RetrievePicklistItemLabel(this IOrganizationService service, string entityName, string attributeName, int value) | ||
{ | ||
try | ||
{ | ||
var request = new RetrieveAttributeRequest { EntityLogicalName = entityName, LogicalName = attributeName }; | ||
var response = (RetrieveAttributeResponse)service.Execute(request); | ||
var picklistMetadata = (PicklistAttributeMetadata)response.AttributeMetadata; | ||
var option = picklistMetadata.OptionSet.Options.FirstOrDefault(item => item.Value.HasValue && item.Value.Value == value); | ||
if (option == null) | ||
throw new ArgumentOutOfRangeException(nameof(value), $"Getting picklist label error. Unknown value {value}."); | ||
return option.Label.UserLocalizedLabel.Label; | ||
} | ||
catch (ArgumentOutOfRangeException) | ||
{ | ||
throw; | ||
} | ||
catch (InvalidPluginExecutionException) | ||
{ | ||
throw; | ||
} | ||
catch (Exception ex) | ||
{ | ||
throw new InvalidPluginExecutionException($"Getting picklist label error. {ex.Message}", ex); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shfbBuild product="Sandcastle Help File Builder and Tools" version="2018.7.8.0" projectFile="C:\Projects\PZone\CRM\PZone SDK XRM\PZone SDK XRM.shfbproj" started="10.09.2018 16:28:00"> | ||
<shfbBuild product="Sandcastle Help File Builder and Tools" version="2018.7.8.0" projectFile="C:\Projects\PZone\CRM\PZone SDK XRM\PZone SDK XRM.shfbproj" started="03.10.2018 17:04:36"> | ||
<buildStep step="Initializing"> | ||
Finding tools... | ||
The Sandcastle tools are located in 'C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\' | ||
|
@@ -28,16 +28,16 @@ Copying XML comments files | |
<buildStep step="GenerateSharedContent"> | ||
Generating shared content files (en-US, Английский (США))... | ||
<plugIn name="Lightweight Website Style" behavior="After" priority="1000"> | ||
</plugIn> Last step completed in 00:00:00,0045 | ||
</plugIn> Last step completed in 00:00:00,0390 | ||
</buildStep> | ||
<buildStep step="GenerateApiFilter"> | ||
Generating API filter for MRefBuilder... | ||
Last step completed in 00:00:00,0000 | ||
Last step completed in 00:00:00,0075 | ||
</buildStep> | ||
<buildStep step="GenerateReflectionInfo"> | ||
Generating reflection information... | ||
[C:\Program Files (x86)\MSBuild\14.0\bin\amd64\MSBuild.exe - GenerateRefInfo.proj] | ||
‘Ў®аЄ  ­ з в  10.09.2018 16:28:01. | ||
‘Ў®аЄ  ­ з в  03.10.2018 17:04:39. | ||
Џа®ҐЄв "C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\GenerateRefInfo.proj" ў 㧫Ґ 1 (楫ҐўлҐ ®ЎкҐЄвл Ї® 㬮«з ­Ёо). | ||
PrepareForBuild: | ||
‘®§¤ ­ЁҐ Є в «®Ј  "obj\Debug\". | ||
|
@@ -47,7 +47,7 @@ GenerateRefInfo: | |
Portions Copyright c 2006-2018, Eric Woodruff, All Rights Reserved. | ||
No source code context base path specified. Source context information is unavailable. | ||
Loaded 1 assemblies for reflection and 1 dependency assemblies. | ||
Wrote information on 1 namespaces, 4 types, and 8 members | ||
Wrote information on 1 namespaces, 5 types, and 9 members | ||
Љ®ЇЁа®ў ­ЁҐ д ©«  Ё§ "reflection.org" ў "reflection.all". | ||
XslTransform (v2018.7.8.0) | ||
Copyright c 2006-2018, Microsoft Corporation, All Rights Reserved. | ||
|
@@ -57,13 +57,13 @@ GenerateRefInfo: | |
|
||
‘Ў®аЄ  гбЇҐи­® § ўҐа襭 . | ||
|
||
‡ ва зҐ­­®Ґ ўаҐ¬п: 00:00:00.87 | ||
Last step completed in 00:00:01,1288 | ||
‡ ва зҐ­­®Ґ ўаҐ¬п: 00:00:01.37 | ||
Last step completed in 00:00:01,7556 | ||
</buildStep> | ||
<buildStep step="TransformReflectionInfo"> | ||
Transforming reflection output... | ||
[C:\Program Files (x86)\MSBuild\14.0\bin\amd64\MSBuild.exe - TransformManifest.proj] | ||
‘Ў®аЄ  ­ з в  10.09.2018 16:28:03. | ||
‘Ў®аЄ  ­ з в  03.10.2018 17:04:41. | ||
Џа®ҐЄв "C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\TransformManifest.proj" ў 㧫Ґ 1 (楫ҐўлҐ ®ЎкҐЄвл Ї® 㬮«з ­Ёо). | ||
TransformManifest: | ||
XslTransform (v2018.7.8.0) | ||
|
@@ -88,26 +88,26 @@ TransformManifest: | |
|
||
‘Ў®аЄ  гбЇҐи­® § ўҐа襭 . | ||
|
||
‡ ва зҐ­­®Ґ ўаҐ¬п: 00:00:00.56 | ||
Last step completed in 00:00:00,7932 | ||
‡ ва зҐ­­®Ґ ўаҐ¬п: 00:00:00.98 | ||
Last step completed in 00:00:01,3024 | ||
</buildStep> | ||
<buildStep step="GenerateNamespaceSummaries"> | ||
Generating namespace summary information... | ||
Last step completed in 00:00:00,0030 | ||
Last step completed in 00:00:00,0280 | ||
</buildStep> | ||
<buildStep step="CopyAdditionalContent"> | ||
Copying additional content files... | ||
No additional content to copy | ||
Last step completed in 00:00:00,0000 | ||
Last step completed in 00:00:00,0080 | ||
</buildStep> | ||
<buildStep step="MergeTablesOfContents"> | ||
Merging conceptual and additional tables of contents... | ||
Last step completed in 00:00:00,0000 | ||
Last step completed in 00:00:00,0010 | ||
</buildStep> | ||
<buildStep step="GenerateIntermediateTableOfContents"> | ||
Generating intermediate table of contents file... | ||
[C:\Program Files (x86)\MSBuild\14.0\bin\amd64\MSBuild.exe - GenerateIntermediateTOC.proj] | ||
‘Ў®аЄ  ­ з в  10.09.2018 16:28:03. | ||
‘Ў®аЄ  ­ з в  03.10.2018 17:04:42. | ||
Џа®ҐЄв "C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\GenerateIntermediateTOC.proj" ў 㧫Ґ 1 (楫ҐўлҐ ®ЎкҐЄвл Ї® 㬮«з ­Ёо). | ||
GenerateIntermediateTOC: | ||
XslTransform (v2018.7.8.0) | ||
|
@@ -118,47 +118,48 @@ GenerateIntermediateTOC: | |
|
||
‘Ў®аЄ  гбЇҐи­® § ўҐа襭 . | ||
|
||
‡ ва зҐ­­®Ґ ўаҐ¬п: 00:00:00.14 | ||
‡ ва зҐ­­®Ґ ўаҐ¬п: 00:00:00.17 | ||
Generating conceptual content intermediate TOC file... | ||
Last step completed in 00:00:00,3966 | ||
Last step completed in 00:00:00,5406 | ||
</buildStep> | ||
<buildStep step="CreateBuildAssemblerConfigs"> | ||
Creating Sandcastle configuration files... | ||
sandcastle.config | ||
Last step completed in 00:00:00,1330 | ||
Last step completed in 00:00:00,2875 | ||
</buildStep> | ||
<buildStep step="MergeCustomConfigs"> | ||
Merging custom build component configurations | ||
C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\sandcastle.config | ||
Updating reference topic configurations. | ||
Replacing default configuration for 'Code Block Component' with the custom configuration | ||
No conceptual content. Removing conceptual content components. | ||
Last step completed in 00:00:00,0030 | ||
Last step completed in 00:00:00,0175 | ||
</buildStep> | ||
<buildStep step="BuildTopics"> | ||
Building help topics... | ||
[C:\Program Files (x86)\MSBuild\14.0\bin\amd64\MSBuild.exe - BuildTopics.proj] | ||
‘Ў®аЄ  ­ з в  10.09.2018 16:28:04. | ||
‘Ў®аЄ  ­ з в  03.10.2018 17:04:43. | ||
Џа®ҐЄв "C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\BuildTopics.proj" ў 㧫Ґ 1 (楫ҐўлҐ ®ЎкҐЄвл Ї® 㬮«з ­Ёо). | ||
BuildTopics: | ||
BuildAssembler (v2018.7.8.0) | ||
Copyright c 2006-2018, Microsoft Corporation, All Rights Reserved. | ||
Portions Copyright c 2006-2018, Eric Woodruff, All Rights Reserved. | ||
Loading configuration... | ||
Processing topics... | ||
Processed 19 topic(s) | ||
Processed 22 topic(s) | ||
CopyFromIndexComponent: "reflection" in-memory cache entries used: 2 of 15. | ||
CopyFromIndexComponent: "comments" in-memory cache entries used: 1 of 30. | ||
ResolveReferenceLinksComponent: 1 entries added to the MSDN content ID cache. New cache size: 114 entries | ||
‘Ў®аЄ  Їа®ҐЄв  "C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\BuildTopics.proj" § ўҐа襭  (楫ҐўлҐ ®ЎкҐЄвл Ї® 㬮«з ­Ёо). | ||
|
||
‘Ў®аЄ  гбЇҐи­® § ўҐа襭 . | ||
|
||
‡ ва зҐ­­®Ґ ўаҐ¬п: 00:00:07.81 | ||
Last step completed in 00:00:08,0442 | ||
‡ ва зҐ­­®Ґ ўаҐ¬п: 00:00:13.19 | ||
Last step completed in 00:00:13,5202 | ||
</buildStep> | ||
<buildStep step="CombiningIntermediateTocFiles"> | ||
Combining conceptual and API intermediate TOC files... | ||
Last step completed in 00:00:00,0010 | ||
Last step completed in 00:00:00,0020 | ||
</buildStep> | ||
<buildStep step="ExtractingHtmlInfo"> | ||
Extracting HTML info for HTML Help 1 and/or website... | ||
|
@@ -170,11 +171,11 @@ E-Mail: [email protected] | |
Using LCID '1033', code page '65001', encoding charset 'UTF-8'. | ||
|
||
Processing website files in C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\Output\Website | ||
Processed 19 HTML files | ||
Processed 22 HTML files | ||
Sorting keywords and generating See Also indices | ||
Saving website keyword index to C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\WebKI.xml | ||
Saving website table of contents to C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\WebTOC.xml | ||
Last step completed in 00:00:00,3533 | ||
Last step completed in 00:00:00,4104 | ||
</buildStep> | ||
<buildStep step="CopyStandardHelpContent"> | ||
Copying standard help content... | ||
|
@@ -256,7 +257,7 @@ C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\PresentationStyle | |
C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\PresentationStyles\VS2013\Web\scripts\branding-Website.js -> C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\Output\Website\scripts\branding-Website.js | ||
C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\PresentationStyles\VS2013\Web\scripts\clipboard.min.js -> C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\Output\Website\scripts\clipboard.min.js | ||
C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\PresentationStyles\VS2013\Web\scripts\jquery-1.11.0.min.js -> C:\Projects\PZone\CRM\PZone SDK XRM\docs\v8\Working\Output\Website\scripts\jquery-1.11.0.min.js | ||
Last step completed in 00:00:00,1548 | ||
Last step completed in 00:00:00,2187 | ||
</buildStep> | ||
<buildStep step="GenerateHelpFormatTableOfContents"> | ||
Generating website table of contents file... | ||
|
@@ -267,21 +268,21 @@ Generating full-text index for the website... | |
|
||
<plugIn name="Lightweight Website Style" behavior="After" priority="1000"> | ||
Adding lightweight search and TOC elements to each topic... | ||
</plugIn> Last step completed in 00:00:00,0980 | ||
</plugIn> Last step completed in 00:00:00,1720 | ||
</buildStep> | ||
<buildStep step="CopyingWebsiteFiles"> | ||
Copying website files to output folder... | ||
|
||
Copied 149 files for the website content | ||
Last step completed in 00:00:00,1850 | ||
Copied 156 files for the website content | ||
Last step completed in 00:00:00,2280 | ||
</buildStep> | ||
<buildStep step="CleanIntermediates"> | ||
Removing intermediate files... | ||
Last step completed in 00:00:00,0505 | ||
Last step completed in 00:00:00,0500 | ||
</buildStep> | ||
<buildStep step="Completed"> | ||
|
||
Build completed successfully at 10.09.2018 16:28:13. Total time: 00:00:12,4501 | ||
Build completed successfully at 03.10.2018 17:04:57. Total time: 00:00:21,5685 | ||
|
||
</buildStep> | ||
</shfbBuild> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.