Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
ZooY committed Aug 4, 2017
1 parent e03d494 commit 51962fe
Show file tree
Hide file tree
Showing 152 changed files with 3,307 additions and 2 deletions.
85 changes: 85 additions & 0 deletions PZone SDK XRM.shfbproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- The configuration and platform will be used to determine which assemblies to include from solution and
project documentation sources -->
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{667d6a57-3b95-499b-adb9-a135cfd61a3d}</ProjectGuid>
<SHFBSchemaVersion>2015.6.5.0</SHFBSchemaVersion>
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual Studio adds them anyway -->
<AssemblyName>Documentation</AssemblyName>
<RootNamespace>Documentation</RootNamespace>
<Name>Documentation</Name>
<!-- SHFB properties -->
<FrameworkVersion>.NET Framework 4.5</FrameworkVersion>
<OutputPath>docs\v8\</OutputPath>
<HtmlHelpName>Documentation</HtmlHelpName>
<Language>en-US</Language>
<SaveComponentCacheCapacity>100</SaveComponentCacheCapacity>
<BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
<HelpFileFormat>Website</HelpFileFormat>
<IndentHtml>False</IndentHtml>
<KeepLogFile>True</KeepLogFile>
<DisableCodeBlockComponent>False</DisableCodeBlockComponent>
<CleanIntermediates>True</CleanIntermediates>
<HelpFileVersion>1.0.0.0</HelpFileVersion>
<MaximumGroupParts>2</MaximumGroupParts>
<NamespaceGrouping>True</NamespaceGrouping>
<SyntaxFilters>C#</SyntaxFilters>
<SdkLinkTarget>Blank</SdkLinkTarget>
<RootNamespaceContainer>True</RootNamespaceContainer>
<PresentationStyle>VS2013</PresentationStyle>
<Preliminary>False</Preliminary>
<NamingMethod>MemberName</NamingMethod>
<HelpTitle>PZone SDK XRM</HelpTitle>
<CopyrightText>Copyright &amp;#169%3b 2017 Programming Zone</CopyrightText>
<ContentPlacement>AboveNamespaces</ContentPlacement>
<WarnOnMissingSourceContext>False</WarnOnMissingSourceContext>
<DocumentationSources>
<DocumentationSource sourceFile="Source\PZone.Xrm\bin\Release\PZone.Xrm.dll" />
<DocumentationSource sourceFile="Source\PZone.Xrm\bin\Release\PZone.Xrm.xml" /></DocumentationSources>
<ComponentConfigurations>
<ComponentConfig id="Code Block Component" enabled="True" xmlns="">
<component id="Code Block Component">
<basePath value="{@HtmlEncProjectFolder}" />
<outputPaths>{@HelpFormatOutputPaths}</outputPaths>
<allowMissingSource value="false" />
<removeRegionMarkers value="false" />
<colorizer syntaxFile="{@SHFBFolder}PresentationStyles\Colorizer\highlight.xml" styleFile="{@SHFBFolder}PresentationStyles\Colorizer\highlight.xsl" stylesheet="{@SHFBFolder}PresentationStyles\Colorizer\highlight.css" scriptFile="{@SHFBFolder}PresentationStyles\Colorizer\highlight.js" disabled="{@DisableCodeBlockComponent}" language="cs" tabSize="0" numberLines="false" outlining="true" keepSeeTags="true" defaultTitle="true" />
</component>
</ComponentConfig>
</ComponentConfigurations>
<MissingTags>Summary, Parameter, Returns, AutoDocumentCtors, TypeParameter, AutoDocumentDispose</MissingTags>
</PropertyGroup>
<!-- There are no properties for these groups. AnyCPU needs to appear in order for Visual Studio to perform
the build. The others are optional common platform types that may appear. -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
</PropertyGroup>
<!-- Import the SHFB build targets -->
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
<!-- The pre-build and post-build event properties must appear *after* the targets file import in order to be
evaluated correctly. -->
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
</Project>
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# PZone.SDK.XRM
# PZone SDK XRM
Common assembly for MS Dynamics development.

Documentation:
<ul>
<li><a href="https://zooy.github.io/PZone.SDK.XRM/v8/"><b>v8</b>: Dynamics CRM 2016 / Dynamics 365</a></li>
</ul>
22 changes: 22 additions & 0 deletions Source/PZone SDK XRM.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PZone.Xrm", "PZone.Xrm\PZone.Xrm.csproj", "{F661CADF-65DC-47A7-9257-C3BE9E1089F1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F661CADF-65DC-47A7-9257-C3BE9E1089F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F661CADF-65DC-47A7-9257-C3BE9E1089F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F661CADF-65DC-47A7-9257-C3BE9E1089F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F661CADF-65DC-47A7-9257-C3BE9E1089F1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
86 changes: 86 additions & 0 deletions Source/PZone.Xrm/PZone.Xrm.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F661CADF-65DC-47A7-9257-C3BE9E1089F1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PZone.Xrm</RootNamespace>
<AssemblyName>PZone.Xrm</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\PZone.Xrm.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\PZone.Xrm.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>PZone.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="Sdk\EntityExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sdk\IOrganizationServiceExtensions.cs" />
<Compile Include="Sdk\ITracingServiceExtensions.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="PZone.snk" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Crm.Sdk.Proxy, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CrmSdk.CoreAssemblies.8.2.0.2\lib\net452\Microsoft.Crm.Sdk.Proxy.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.6.1.7600.16394\lib\net35\Microsoft.IdentityModel.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CrmSdk.CoreAssemblies.8.2.0.2\lib\net452\Microsoft.Xrm.Sdk.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.DirectoryServices" />
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.IdentityModel" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Binary file added Source/PZone.Xrm/PZone.snk
Binary file not shown.
36 changes: 36 additions & 0 deletions Source/PZone.Xrm/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PZone.Xrm")]
[assembly: AssemblyDescription("Common assembly for MS Dynamics development.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Programming Zone")]
[assembly: AssemblyProduct("PZone SDK XRM")]
[assembly: AssemblyCopyright("Copyright © 2017 Programming Zone")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f661cadf-65dc-47a7-9257-c3be9e1089f1")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("8.0.0.0")]
[assembly: AssemblyFileVersion("8.0.0.0")]
44 changes: 44 additions & 0 deletions Source/PZone.Xrm/Sdk/EntityExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Microsoft.Xrm.Sdk;
using Newtonsoft.Json;


namespace PZone.Xrm.Sdk
{
/// <summary>
/// Расширение функционала перечисления <see cref="Entity"/>.
/// </summary>
// ReSharper disable once CheckNamespace
public static class EntityExtensions
{
/// <summary>
/// Расширение атрибутного состава сущности из других сущностей.
/// </summary>
/// <param name="entity">Сущность.</param>
/// <param name="otherEntities">Набор других сущностей, атрибуты которых последовательно переносятся в исходную сущность.</param>
/// <returns>
/// Метод сливает атрибуты нескольких сущностей в одну.
/// </returns>
public static void Extend(this Entity entity, params Entity[] otherEntities)
{
foreach (var otherEntity in otherEntities)
{
foreach (var attribute in otherEntity.Attributes)
entity[attribute.Key] = attribute.Value;
}
}



/// <summary>
/// Клонирование объекта <see cref="Entity"/>.
/// </summary>
/// <param name="entity">Исходная сущность.</param>
/// <returns>
/// Метод возвращает новый объект типа <see cref="Entity"/>, полученный путем клонирования исходного объекта.
/// </returns>
public static Entity Clone(this Entity entity)
{
return ReferenceEquals(entity, null) ? null : JsonConvert.DeserializeObject<Entity>(JsonConvert.SerializeObject(entity));
}
}
}
53 changes: 53 additions & 0 deletions Source/PZone.Xrm/Sdk/IOrganizationServiceExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;


namespace PZone.Xrm.Sdk
{
/// <summary>
/// Расширение функционала классов, реализующих интерфейс <see cref="IOrganizationService"/>.
/// </summary>
// ReSharper disable once InconsistentNaming
public static class IOrganizationServiceExtensions
{
#region RetrieveMultiple


/// <summary>
/// Получение списка записей по запросу FetchXML.
/// </summary>
/// <param name="service">Экземпляр сервиса CRM.</param>
/// <param name="fetchXml">Текст запроса.</param>
/// <returns>
/// Метод возвращает список найденных записей.
/// </returns>
public static EntityCollection RetrieveMultiple(this IOrganizationService service, string fetchXml)
{
return service.RetrieveMultiple(new FetchExpression(fetchXml));
}


#endregion


#region Execute


/// <summary>
/// Выполнение запроса и получение ответа указанного типа.
/// </summary>
/// <param name="service">Экземпляр сервиса CRM.</param>
/// <param name="request">Запрос.</param>
/// <typeparam name="TResponse">Тип ответа запроса.</typeparam>
/// <returns>
/// Метод выполняет запрос и возвращает ответ указанного типа.
/// </returns>
public static TResponse Execute<TResponse>(this IOrganizationService service, OrganizationRequest request) where TResponse : OrganizationResponse
{
return (TResponse)service.Execute(request);
}


#endregion
}
}
40 changes: 40 additions & 0 deletions Source/PZone.Xrm/Sdk/ITracingServiceExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using Microsoft.Xrm.Sdk;
using Newtonsoft.Json;


namespace PZone.Xrm.Sdk
{
/// <summary>
/// Расширение функционала классов, реализующих интерфейс <see cref="ITracingService"/>.
/// </summary>
// ReSharper disable once InconsistentNaming
public static class ITracingServiceExtensions
{
/// <summary>
/// Запись в трассировку данных об исключении.
/// </summary>
/// <param name="service">Экземпляр сервиса трассеровки.</param>
/// <param name="exception">Данные исключения.</param>
public static void Trace(this ITracingService service, Exception exception)
{
service.Trace($@"{ exception.GetType().FullName}: { exception.Message} (Code {exception.HResult})");
service.Trace(exception.Source);
service.Trace(exception.StackTrace);
}


/// <summary>
/// Запись в трассировку данных об исключении.
/// </summary>
/// <param name="service">Экземпляр сервиса трассеровки.</param>
/// <param name="obj">Объект для записи в трассировку.</param>
public static void Trace(this ITracingService service, object obj)
{
service.Trace(JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
}));
}
}
}
6 changes: 6 additions & 0 deletions Source/PZone.Xrm/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CrmSdk.CoreAssemblies" version="8.2.0.2" targetFramework="net452" />
<package id="Microsoft.IdentityModel" version="6.1.7600.16394" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
</packages>
Loading

0 comments on commit 51962fe

Please sign in to comment.