using System;
using System.Linq;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
public class ServiceContentHelper : OrganizationServiceContext
{
public ServiceContentHelper(Microsoft.Xrm.Sdk.IOrganizationService service) : base(service) { }
public void Retrieve()
{
var entityArray = this.CreateQuery("new_supplyaccount").ToArray();
if (entityArray != null)
{
System.Console.WriteLine("len: " + entityArray.Count());
foreach(Entity en in entityArray){
DisplayEntity(en, "new_supplyaccount");
}
}
}
private void DisplayEntity(Entity entity, string label)
{
System.Console.WriteLine("display" + label + "start_________________________________");
var keyArray = entity.Attributes.Keys;
foreach (string name in keyArray)
{
System.Console.WriteLine("attributeName: " + name + ",attributeValue: " + entity.Attributes[name]);
}
System.Console.WriteLine("display" + label + "end!_________________________________");
}
}