{"id":177273,"date":"2013-04-29T14:50:03","date_gmt":"2013-04-29T10:50:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=177273"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=177273","title":{"rendered":"<span class=\"post_title\">\u041a\u043b\u0438\u0435\u043d\u0442 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 Linq \u0434\u043b\u044f Microsoft Dynamics CRM (\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0438\u0437 sdk)<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0430\u0441\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 MS CRM\u2026 \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 msdn \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u0430 \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u0431\u0435\u0449\u0430\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u044b\u043c, \u0438 \u0434\u0430\u0436\u0435 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c (\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f), \u044f \u0440\u0435\u0448\u0438\u043b \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 QueryExpression \u0432 \u0447\u0438\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u043c\u0443 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442 \u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u0440\u0430\u0441\u0441\u0430\u0434\u043d\u0438\u043a\u043e\u043c \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u043e \u043d\u0435\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (\u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0431\u0443\u0434\u0443\u0442 \u0447\u0430\u0441\u0442\u0435\u043d\u044c\u043a\u043e \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u2014 \u0443 \u043a\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u0442\u043e\u0442 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f). <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 QueryExpression \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f fluent \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a\u0430\u043a \u0432 EF. \u0421\u0440\u0430\u0437\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 (\u0433\u0434\u0435-\u0442\u043e \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435) \u044f \u043d\u0430\u0448\u0435\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438\u0437 sdk \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0430\u043a\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u2014 <a href=\"http:\/\/rostacik.net\/2011\/08\/11\/how-to-read-create-update-and-detele-objects-in-microsoft-crm-2011-on-premise-via-wcf-service\/\">sdk crm client<\/a> \u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043d\u0430 \u043d\u0435\u0435 \u043f\u043e\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u044f \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u0442\u0430\u043c \u043d\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438(!!!) \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 in \u0432 where, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043a join \u0438 \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043c\u0435\u043b\u044c\u0447\u0435. \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u043e\u0437\u0436\u0435. <\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u0431\u0435\u0449\u0430\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u043b\u0433\u0438\u043c, \u044f \u0432\u0441\u0435 \u0436\u0435 \u0440\u0435\u0448\u0438\u043b \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e\u2026<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0438:<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0414\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c DataContract \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 CRM, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438\/\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u0435\u0439 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435<\/li>\n<li>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f fluent \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a CRM \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438, \u0438 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043e\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043f\u043e\u043b\u044f \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438<\/li>\n<li>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c result set \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0439 \u043e\u0442 CRM \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a (Select, Join, Where \u0438 \u0442.\u0434.)<\/li>\n<li>\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u043e\u043b\u0435\u0432\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0432 CRM (ASP.NET Impersonation \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435)<\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u0427\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/h4>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0441\u0431\u043e\u0440\u043a\u0443, \u0432\u0441\u0435\u0433\u043e \u0441 \u043e\u0434\u043d\u043e\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u2014 microsoft.xrm.sdk.dll, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443.<\/p>\n<h5>\u041a\u043b\u0438\u0435\u043d\u0442<\/h5>\n<p>  \u0421\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u2014 CrmClientBase. \u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043e\u0434\u043d\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e:<\/p>\n<pre><code class=\"cs\">protected abstract IWcfCrmClient WcfClient { get; }  <\/code><\/pre>\n<p>  IWcfCrmClient \u2014 \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 WCF \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c (Service Reference). <\/p>\n<p>  \u041a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 (\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u0438\u0442\u044c using \u0438 \u0432\u0441\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c):  <\/p>\n<pre><code class=\"cs\">using System; using CrmClient; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using MsCrmClientTest.MSCRM;  public class OrgCrmClient : CrmClientBase {     private class WcfCrmClient : IWcfCrmClient     {         private OrganizationServiceClient _client;          public Guid Create(Entity entity)         {             return _client.Create(entity);         }         public void Update(Entity entity)         {             _client.Update(entity);         }         public void Delete(string entityName, Guid id)         {             _client.Delete(entityName, id);         }         public EntityCollection RetrieveMultiple(QueryBase query)         {             return _client.RetrieveMultiple(query);         }         public OrganizationResponse Execute(OrganizationRequest request)         {             return _client.Execute(request);         }         public void Close()         {             _client.Close();         }         public WcfCrmClient()         {             _client = new OrganizationServiceClient();         }     }     private IWcfCrmClient _wcfClient;     protected override IWcfCrmClient WcfClient     {         get         {             if (_wcfClient == null)                 _wcfClient = new WcfCrmClient();             return _wcfClient;         }     } } <\/code><\/pre>\n<p>  OrganizationServiceClient \u2014 \u044d\u0442\u043e \u043a\u043b\u0438\u0435\u043d\u0442 \u0438\u0437 Service Reference<\/p>\n<h5>Mapping<\/h5>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438 CRM \u043d\u0443\u0436\u043d\u043e \u0438\u0445 \u0437\u0430\u043c\u0430\u043f\u0438\u0442\u044c \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u044b (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c data contract). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c 2 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 (\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438\u0437 \u0441\u0431\u043e\u0440\u043a\u0438 microsoft.xrm.sdk.dll)  <\/p>\n<ul>\n<li><b>EntityLogicalNameAttribute(string name)<\/b> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0438\u043c\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 CRM<\/li>\n<li><b>AttributeLogicalNameAttribute(string name)<\/b> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0438\u043c\u044f \u043f\u043e\u043b\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 CRM<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u044b, \u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043c\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438\/\u043f\u043e\u043b\u044f \u0432 CRM \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430\/\u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 data contract \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d \u043e\u0442 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 CrmDataContractBase. \u042d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0441 \u043e\u0434\u043d\u0438\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c  <\/p>\n<pre><code class=\"cs\">public abstract Guid Id { get; set; } <\/code><\/pre>\n<p>  \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438 \u0442\u043e\u0436\u0435 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c AttributeLogicalName.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 data contract:  <\/p>\n<pre><code class=\"cs\">[EntityLogicalName(&quot;systemuser&quot;)] public class User : CrmDataContractBase {     [AttributeLogicalName(&quot;systemuserid&quot;)]     public override Guid Id { get; set; }     [AttributeLogicalName(&quot;fullname&quot;)]     public string Name { get; set; }     [AttributeLogicalName(&quot;parentsystemuserid&quot;)]     public EntityReference \u0421hief { get; set; }     [AttributeLogicalName(&quot;caltype&quot;)]     public OptionSetValue CALType } <\/code><\/pre>\n<p>  <i><b>\u0412\u0410\u0416\u041d\u041e!<\/b><\/i>   <\/p>\n<ul>\n<li>\u0415\u0441\u043b\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c CRM (\u043a\u0430\u043a \u0421hief \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435) \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u0438\u043f\u0430 EntityReference<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u0437 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f CRM (\u043a\u0430\u043a CALType \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435) \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u0438\u043f\u0430 OptionSetValue<\/li>\n<\/ul>\n<p>  <\/p>\n<h5>Mapping \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 CRM<\/h5>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u0430\u043f\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f CRM, \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0442 CrmOptionsSetBase \u0438 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c EntityLogicalName, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043c\u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 CRM:  <\/p>\n<pre><code class=\"cs\">[EntityLogicalName(&quot;connectionrole_category&quot;)] public class ConnectionRoleCategoryEnum : CrmOptionsSetBase { } <\/code><\/pre>\n<p>  CrmOptionsSetBase \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IEnumerable \u0442\u0438\u043f\u0430 CrmOption, \u0442.\u0435. \u0438\u043c \u0441\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u0432.<br \/>  \u041a\u043b\u0430\u0441\u0441 CrmOption \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 2 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430:  <\/p>\n<pre><code class=\"cs\">public string Label { get; private set; } public OptionSetValue Value { get; private set; } <\/code><\/pre>\n<p>  \u0412 Label \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0438\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0430 Value \u044d\u0442\u043e \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 OptionSetValue, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 data contract \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 CRM<\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/h4>\n<p>  <\/p>\n<h5>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 CRM<\/h5>\n<p>  \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0432\u0441\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430:  <\/p>\n<pre><code class=\"cs\">[EntityLogicalName(&quot;new_nsi&quot;)] public class NSI : ICrmDataContract {     [AttributeLogicalName(&quot;new_nsiid&quot;)]     public override Guid Id { get; set; }     [AttributeLogicalName(&quot;new_name&quot;)]     public string Name { get; set; } } \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 var newnsi = new NSI { Name = &quot;Test NSI&quot; }; _client.Add(newnsi); \/\/\u041c\u0435\u0442\u043e\u0434 'Add' \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e 'Id' \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a \u0432 EF \/\/\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 newnsi.Name = &quot;Test NSI 2&quot;; _client.Update(newnsi); \/\/\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 _client.Delete(newnsi); <\/code><\/pre>\n<p>  <i><b>\u0412\u0410\u0416\u041d\u041e!<\/b><\/i> \u0412\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432 CRM \u0441\u0440\u0430\u0437\u0443 \u0436\u0435. \u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0435\u0442 (\u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0435\u0449\u0435)<\/p>\n<h5>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 CRM<\/h5>\n<p>  \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434   <\/p>\n<pre><code class=\"cs\">public T OptionsSet&lt;T&gt;() <\/code><\/pre>\n<p>  \u0413\u0434\u0435 T \u2014 data contract \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u043c\u0435\u0440 (data contarct \u043e\u043f\u0438\u0441\u0430\u043d \u0432\u044b\u0448\u0435):  <\/p>\n<pre><code class=\"cs\">var optionSet = _client.OptionsSet&lt;ConnectionRoleCategoryEnum&gt;(); <\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043a CRM \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Linq<\/h4>\n<p>  \u0412 namespace CrmClient.Linq \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f fluent \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a CRM:  <\/p>\n<ul>\n<li>CrmSelect<\/li>\n<li>CrmWhere<\/li>\n<li>CrmJoin<\/li>\n<li>CrmOrder<\/li>\n<li>CrmPaging<\/li>\n<li>CrmDistinct<\/li>\n<\/ul>\n<p>  \u041c\u0435\u0442\u043e\u0434\u044b \u0438\u0437 \u044d\u0442\u043e\u0433\u043e namespace \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 Crm, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u0431\u044b\u043b\u043e \u0432\u0438\u0434\u043d\u043e \u0433\u0434\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u043a CRM \u0430 \u0433\u0434\u0435 \u0438\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0443\u0436\u0435 \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. <br \/>  \u0421\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a CRM \u2014 Query:<\/p>\n<pre><code class=\"cs\">public ICrmQueryable&lt;T&gt; Query&lt;T&gt;() <\/code><\/pre>\n<p>  \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<br \/>  \u0421\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a CRM \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f. \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 GetEnumerator(), \u0442.\u0435 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (\u043a\u0430\u043a \u0432 EF).<\/p>\n<h5>Select<\/h5>\n<p>  \u0410\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0439 \u0442\u0438\u043f  <\/p>\n<pre><code class=\"cs\">var users = _client.Query&lt;CrmUser&gt;()     .CrmSelect(u =&gt; new     {         u.Id,         u.Name,         Test = 1     })     .ToList(); <\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 (\u043a\u0430\u043a \u0438 \u0432 EF, \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0431\u0435\u0437 \u043f\u0430\u0430\u0440\u043c\u0435\u0442\u0440\u043e\u0432)  <\/p>\n<pre><code class=\"cs\">var users2 = _client.Query&lt;CrmUser&gt;()     .CrmSelect(u =&gt; new TestUser()     {         Id = u.Id,         FullName = u.Name,         Test = 1     })     .ToList(); <\/code><\/pre>\n<p>  <\/p>\n<h5>Where<\/h5>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/\u043f\u0440\u043e\u0441\u0442\u043e\u0439 var user = _client.Query&lt;CrmUser&gt;()     .CrmWhere(i =&gt; i.Id == _directorUserId)     .Single();  var list = new[] { _directorUserId }; \/\/ in var filteredUsers = _client.Query&lt;CrmUser&gt;()                .CrmWhere(i =&gt; list.Contains(i.Id))                .ToList(); \/\/ not in filteredUsers = _client.Query&lt;CrmUser&gt;()                .CrmWhere(i =&gt; !list.Contains(i.Id))                .ToList(); \/\/like var users = _client.Query&lt;CrmUser&gt;().ToList(); var firstUser = users.First(i =&gt; i.Name.Contains(&quot; &quot;)).Name.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); \/\/ like text% var user = _client.Query&lt;CrmUser&gt;()     .CrmWhere(i =&gt; i.Name.StartsWith(firstUser[0]))     .ToList(); \/\/ like %text user = _client.Query&lt;CrmUser&gt;()     .CrmWhere(i =&gt; i.Name.EndsWith(firstUser[0]))     .ToList(); \/\/ like %text% user = _client.Query&lt;CrmUser&gt;()    .CrmWhere(i =&gt; i.Name.Contains(firstUser[0]))    .ToList(); \/\/ not like text% user = _client.Query&lt;CrmUser&gt;()     .CrmWhere(i =&gt; !i.Name.StartsWith(firstUser[0]))     .ToList(); \/\/ not like %text user = _client.Query&lt;CrmUser&gt;()     .CrmWhere(i =&gt; !i.Name.EndsWith(firstUser[0]))     .ToList(); \/\/ not like %text% user = _client.Query&lt;CrmUser&gt;()     .CrmWhere(i =&gt; !i.Name.Contains(firstUser[0]))     .ToList(); <\/code><\/pre>\n<p>  <i><b>\u0412\u0410\u0416\u041d\u041e!<\/b><\/i> \u0414\u043b\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 &#8216;in&#8217; \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u0441\u0441\u0438\u0432 (array). \u042d\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u044f \u0443\u0431\u0435\u0440\u0443 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 (\u043a\u0430\u043a \u0432 \u043c\u043e\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438 \u0434\u043b\u044f EF <a href=\"http:\/\/habrahabr.ru\/post\/152417\/\">\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u00abWHERE\u00bb \u043f\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u0430\u043c \u0432 Entity Framework<\/a>):  <\/p>\n<pre><code class=\"cs\">var users = _client.Query&lt;CrmUser&gt;().ToList(); var directors = users.Where(u =&gt; u.Director != null).Select(u =&gt; new { u.Director.Id, u.Director.Name }).Take(2); var users2 = _client.Query&lt;CrmUser&gt;()     .CrmWhere(ExpressionType.Or, directors, (u, d) =&gt; u.Id == d.Id && u.Name == d.Name, (pn, o) =&gt;         {             switch (pn)             {                 case &quot;Id&quot;:                     return o.Id;                 case &quot;Name&quot;:                     return o.Name;                 default:                     return null;             }         })     .ToList(); <\/code><\/pre>\n<p>  <\/p>\n<h5>Order<\/h5>\n<p>  <\/p>\n<pre><code class=\"cs\">var users = _client.Query&lt;CrmUser&gt;()     .CrmOrderBy(i =&gt; i.Name)     .CrmOrderByDescending(i =&gt; i.Id)     .ToList(); <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e Name asc, \u043f\u043e\u0442\u043e\u043c \u043f\u043e Id desc<\/p>\n<h5>Distinct<\/h5>\n<p>  <\/p>\n<pre><code class=\"cs\">var users = _client.Query&lt;CrmUser&gt;()     .CrmDistinct()     .ToList(); <\/code><\/pre>\n<p>  <\/p>\n<h5>Join<\/h5>\n<p>  C Join \u0434\u0435\u043b\u0430 \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u0447\u0443\u0442\u044c \u043f\u043e\u0441\u043b\u043e\u0436\u043d\u0435\u0435\u2026 \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c join \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0432\u043e\u0438\u0445 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439:<\/p>\n<pre><code class=\"cs\">var users = _client.Query&lt;CrmUser&gt;()     .CrmJoin(_client.Query&lt;CrmUser&gt;(), s =&gt; s.Chief.Id, d =&gt; d.Id, (s, d) =&gt; new { s.Id, s.Name, ChiefId = d.Id, ChiefFullName = d.Name })     .ToList();  or  var users = _client.Query&lt;CrmUser&gt;()     .CrmLeftJoin(_client.Query&lt;CrmUser&gt;(), s =&gt; s.Chief.Id, d =&gt; d.Id, (s, d) =&gt; new { s.Id, s.Name, ChiefId = d.Id, ChiefFullName = d.Name })     .ToList(); <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u041d\u043e \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Id \u0443 s.Chief \u043d\u0435 \u0437\u0430\u043c\u0430\u043f\u043b\u0435\u043d\u043e \u043d\u0438\u043a\u0443\u0434\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u0430 EntityReference\u2026 \u041d\u043e \u0441\u0430\u043c\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e s.Chief \u0437\u0430\u043c\u0430\u043f\u043b\u0435\u043d\u043e \u043d\u0430 \u043d\u0443\u0436\u043d\u043e\u0435 \u043d\u0430\u043c &#8216;parentsystemuserid&#8217; CRM\u2026 \u041a\u043b\u0438\u0435\u043d\u0442 \u0441\u0430\u043c \u0440\u0430\u0437\u0440\u0443\u043b\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0432 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a CRM &#8216;parentsystemuserid&#8217; \u0438\u0437 s.Chief, \u0430 \u0437\u0430\u043f\u0438\u0441\u044c s =&gt; s.Chief.Id, d =&gt; d.Id \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043d\u0430 join \u0437\u0430\u043f\u0440\u043e\u0441. \u0412 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 CRM \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 Link, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0441\u0430\u043c\u043e\u043c join \u0437\u0430\u043f\u0440\u043e\u0441\u0435:<\/p>\n<pre><code class=\"cs\">var users = _client.Query&lt;CrmUser&gt;()     .CrmJoin(_client.Query&lt;CrmUser&gt;().CrmWhere(u =&gt; u.Id == _directorUserId), s =&gt; s.Chief.Id, d =&gt; d.Id, (s, d) =&gt; new { s.Id, s.Name, ChiefId = d.Id, ChiefFullName = d.Name })     .ToList();  or  var users = _client.Query&lt;CrmUser&gt;()     .CrmLeftJoin(_client.Query&lt;CrmUser&gt;().CrmWhere(u =&gt; u.Id == _directorUserId), s =&gt; s.Chief.Id, d =&gt; d.Id, (s, d) =&gt; new { s.Id, s.Name, ChiefId = d.Id, ChiefFullName = d.Name })     .ToList(); <\/code><\/pre>\n<p>  _client.Query().CrmWhere(u =&gt; u.Id == _directorUserId) \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0430 join. \u0422.\u0435. \u0435\u0441\u043b\u0438 \u044d\u0442\u043e inner join \u0442\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440 \u0441 id _directorUserId. \u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Order, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0434\u0430\u0441\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0430, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 Where.<\/p>\n<h5>NoLock<\/h5>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 CRM \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u0441 \u043e\u043f\u0446\u0438\u0435\u0439 with(nolock) \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0442\u0447\u0435\u0442\u0430 \u0437\u0430 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u043f\u0435\u0440\u0438\u043e\u0434. \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cs\">var users = _client.Query&lt;CrmUser&gt;()     .CrmNoLock()     .ToList(); <\/code><\/pre>\n<p>  <\/p>\n<h5>Paging<\/h5>\n<p>  CRM \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u0443\u044e \u0432\u044b\u0434\u0430\u0447\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <\/p>\n<pre><code class=\"cs\">List&lt;T&gt; CrmGetPage(int pageNumber, int pageSize, out int totalCount, out bool moreRecordsExists) <\/code><\/pre>\n<p>  \u041e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 List, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432 \u0441\u0440\u0430\u0437\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a CRM.<br \/>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0447\u0442\u043e \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 CRM. \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cs\">int total; bool moreExists; var users = _client.Query&lt;CrmUser&gt;().CrmGetPage(1, 10, out total, out moreExists); <\/code><\/pre>\n<p>  <i><b>(\u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435)<\/b><\/i><\/p>\n<h4>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/h4>\n<p>  \u0412 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f reflection \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e mapping, \u0438 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u044d\u0448\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u2026 <br \/>  \u041a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 CRM \u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a. \u041a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u2014 \u043e\u0434\u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0438\u043f. \u041d\u043e \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0430: <i>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0447\u0435\u0440\u0435\u0437 reflection. \u042d\u0442\u043e \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u043e \u0442\u0435\u043c, \u0447\u0442\u043e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043a\u0430\u0445 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0442\u0438\u043f \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e<\/i>. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e \u0437\u043d\u0430\u0435\u0442 \u043a\u0430\u043a \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u044d\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u044f \u044d\u0442\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u044e.<\/p>\n<h4>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438\u0437 SDK<\/h4>\n<p>  \u041f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u0438\u0437 SDK \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b (\u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u0430). \u0418\u0437-\u0437\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 CRM \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u043b \u0432\u0441\u0435 \u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u0438\u0437 SDK \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 CRM \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0443\u0436\u0435 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430&#8230;), \u0438\u0437 \u043a\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0430 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 IQueryable \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f Linq.<\/p>\n<p>  \u0421\u0430\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0435\u0441\u0442\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<pre><code class=\"cs\">Operation       ThisCrmClient           SdkCrmClient  Query           00:00:25.6005598        00:01:01.1291123 Select          00:00:03.5173517        00:00:03.6273627 Order           00:00:08.2558255        00:00:08.2338233 Where           00:00:04.1074107        00:00:03.9203920 WhereIn         00:00:05.3745374        not supported %Like%          00:00:03.3983398        00:00:03.4093409 %Like           00:00:03.4403440        00:00:03.4163416 Like%           00:00:03.3093309        00:00:03.3033303 Join            00:00:03.4313431        00:00:03.4143414 JoinFilter      00:00:03.3833383        not supported NoLock          00:00:09.6899689        not supported Distinct        00:00:07.9847984        00:00:08.0328032 <\/code><\/pre>\n<h4>\u0421\u0431\u043e\u0440\u043a\u0438 \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438<\/h4>\n<p>  \u0417\u0430\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430 codeplex \u2014 <a href=\"https:\/\/mscrmclient.codeplex.com\/\">mscrmclient<\/a>. Solution \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 3\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432:  <\/p>\n<ul>\n<li><b>MsCrmClient<\/b> \u2014 \u0441\u0430\u043c \u043a\u043b\u0438\u0435\u043d\u0442<\/li>\n<li><b>MsCrmClientTest<\/b> \u2014 \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/li>\n<li><b>PerfomanceTest<\/b> \u2014 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441 \u043ak\u0438\u0435\u043d\u0442\u043e\u043c \u0438\u0437 SDK<\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u041d\u0430 codeplex \u044f \u043f\u0438\u0441\u0430\u043b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c, \u0440\u0443\u0441\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u2014 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f.<\/p>\n<p>  \u0412\u0441\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0430\u0439\u0434\u0443 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u044f \u0431\u0443\u0434\u0443 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 codeplex. \u0415\u0441\u043b\u0438 \u0412\u044b \u0440\u0435\u0448\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 issue \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u042f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439. \u0412\u0441\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u044f \u0431\u0443\u0434\u0443 \u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043a\u0440\u0430\u0442\u0447\u0430\u0439\u0448\u0438\u0435 \u0441\u0440\u043e\u043a\u0438 (\u044d\u0442\u043e \u0432 \u043c\u043e\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430\u0445 \u0445\u043e\u0442\u044f \u0431\u044b \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u044f \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u044d\u0442\u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445).    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/177273\/\"> http:\/\/habrahabr.ru\/post\/177273\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0430\u0441\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 MS CRM\u2026 \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 msdn \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u0430 \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u0431\u0435\u0449\u0430\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u044b\u043c, \u0438 \u0434\u0430\u0436\u0435 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c (\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f), \u044f \u0440\u0435\u0448\u0438\u043b \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 QueryExpression \u0432 \u0447\u0438\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u043c\u0443 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442 \u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u0440\u0430\u0441\u0441\u0430\u0434\u043d\u0438\u043a\u043e\u043c \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u043e \u043d\u0435\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (\u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0431\u0443\u0434\u0443\u0442 \u0447\u0430\u0441\u0442\u0435\u043d\u044c\u043a\u043e \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u2014 \u0443 \u043a\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u0442\u043e\u0442 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f). <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 QueryExpression \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f fluent \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a\u0430\u043a \u0432 EF. \u0421\u0440\u0430\u0437\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 (\u0433\u0434\u0435-\u0442\u043e \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435) \u044f \u043d\u0430\u0448\u0435\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438\u0437 sdk \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0430\u043a\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u2014 <a href=\"http:\/\/rostacik.net\/2011\/08\/11\/how-to-read-create-update-and-detele-objects-in-microsoft-crm-2011-on-premise-via-wcf-service\/\">sdk crm client<\/a> \u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043d\u0430 \u043d\u0435\u0435 \u043f\u043e\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u044f \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u0442\u0430\u043c \u043d\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438(!!!) \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 in \u0432 where, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043a join \u0438 \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043c\u0435\u043b\u044c\u0447\u0435. \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u043e\u0437\u0436\u0435. <\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u0431\u0435\u0449\u0430\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u043b\u0433\u0438\u043c, \u044f \u0432\u0441\u0435 \u0436\u0435 \u0440\u0435\u0448\u0438\u043b \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-177273","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=177273"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177273\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}