标签:crm快速开发之entitycollec crm自定义开发 entitycollection crm crm开发
/* 创建者:菜刀居士的博客
* 创建日期: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,布布扣,bubuko.com
标签:crm快速开发之entitycollec crm自定义开发 entitycollection crm crm开发
原文地址:http://blog.csdn.net/y_f123/article/details/37497725