zoukankan      html  css  js  c++  java
  • crm高速开发之EntityCollection

    /* 创建者:菜刀居士的博客
     * 创建日期: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);
                    }
                }
            }
        }
    }

     

    对照:

查看全文
  • 相关阅读:
    Windows Mobile开发资源列表
    Windows Mobile获取SIM卡上的所有电话号码
    Windows Mobile手机软件安装卸载方法
    Windows CE跨进程内存注入之原理
    推荐几篇关于Windows Mobile程序安装包制作的文章
    C#智能设备中程序的调用
    Windows Mobile 获得 MAC,IP,IMEI,IMSI
    为什么要使用Base64?
    如何选择正确的SQL Server Compact安装包
    [Drupal] Using the Administrator theme whenever you want.
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10799608.html
  • Copyright © 2011-2022 走看看