码迷,mamicode.com
首页 > 其他好文 > 详细

crm高速开发之EntityCollection

时间:2019-05-01 13:34:42      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:multi   temp   post   col   sys   ons   pop   博客   sdn   

/* 创建者:菜刀居士的博客
?* 创建日期:2014年07月07号
?*/

namespace Net.CRM.OrganizationService
{
??? using System;
??? using Microsoft.Xrm.Sdk;
??? using Microsoft.Xrm.Sdk.Query;

??? /// <summary>
??? /// EntityCollection
??? /// </summary>
??? public class EntityCollectionDemo
??? {
??????? /// <summary>
??????? /// 基本模式,遍历EntityCollection
??????? /// </summary>
??????? public void Run(EntityCollection ec,IOrganizationService service)
??????? {
??????????? if (ec != null && ec.Entities.Count > 0)
??????????? {
??????????????? foreach(Entity en in ec.Entities)
??????????????? {
??????????????????? service.Delete(en.LogicalName, en.Id);
??????????????? }
??????????? }
??????? }

??????? /// <summary>
??????? /// 高速模式,遍历EntityCollection
??????? /// </summary>
??????? public void QuickRun(EntityCollection ec, IOrganizationService service)
??????? {
??????????? ec.ReadMultiple(en => { service.Delete(en.LogicalName, en.Id); });
??????? }
??? }

??? /// <summary>
??? /// 扩展方法
??? /// </summary>
??? public static class ExtensionFunction
??? {
??????? public static void ReadMultiple(this EntityCollection ec,Action<Entity> action)
??????? {
??????????? if (ec != null && ec.Entities.Count > 0)
??????????? {
??????????????? foreach (Entity en in ec.Entities)
??????????????? {
??????????????????? action(en);
??????????????? }
??????????? }
??????? }
??? }
}

?

对照:

技术图片

crm高速开发之EntityCollection

标签:multi   temp   post   col   sys   ons   pop   博客   sdn   

原文地址:https://www.cnblogs.com/ldxsuanfa/p/10799608.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
分享档案
周排行
mamicode.com排行更多图片
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!