Skip to content

IOrganizationService Extensions

Artem Grunin edited this page Apr 23, 2019 · 17 revisions

IOrganizationService Extensions

Set of extension methods for IOrganizationService base class. Basically these are simple overrides of existing methods which take EntityReference or Entity instead of separate Id and LogicalName parameters.

Associate & Disassociate

Associate & Disassociate methods override. Take EntityReference (instead of separate Id + LogicalName) input parameter.

public void Associate(EntityReference primaryEntity, Relationship relationship, EntityReferenceCollection relatedEntities);
public void Associate(EntityReference primaryEntity, Relationship relationship, IList<EntityReference> relatedEntities);
public void Associate(EntityReference primaryEntity, String relationshipName, EntityReferenceCollection relatedEntities);
public void Associate(EntityReference primaryEntity, String relationshipName, IList<EntityReference> relatedEntities);

public void Disassociate(EntityReference primaryEntity, Relationship relationship, EntityReferenceCollection relatedEntities);
public void Disassociate(EntityReference primaryEntity, Relationship relationship, IList<EntityReference> relatedEntities);
public void Disassociate(EntityReference primaryEntity, String relationshipName, EntityReferenceCollection relatedEntities);
public void Disassociate(EntityReference primaryEntity, String relationshipName, IList<EntityReference> relatedEntities);

Delete

Delete method override. Take EntityReference (instead of separate Id + LogicalName) input parameter. Alternative keys are supported since v 1.0.29

public void Delete(EntityReference reference);
public void Delete(Entity entity);

Delete by Alternative key

Delete method override. Deletes using Alternative keys instead of Id. This one use Execute under the hood

public void Delete(string logicalName, KeyAttributeCollection keyAttributeCollection);
public void Delete(string logicalName, string keyName, object keyValue);

Retrieve

Retrieve method override. Take EntityReference (instead of separate Id + LogicalName) input parameter. Alternative keys are supported since v 1.0.29

public Entity Retrieve(EntityReference reference, ColumnSet columnSet);
public Entity Retrieve(EntityReference reference, params String[] columns);

Retrieve<T>

Generic version of Retrieve.

public T Retrieve<T>(EntityReference reference, ColumnSet columnSet) where T : Entity;
public T Retrieve<T>(EntityReference reference, params String[] columns) where T : Entity;

Retrieve by Alternative key

Retrieve method override. Take EntityReference instead of Id. This one use Execute under the hood

public Entity Retrieve(string logicalName, KeyAttributeCollection keyAttributeCollection, ColumnSet columnSet);
public Entity Retrieve(string logicalName, string keyName, object keyValue, ColumnSet columnSet);
public Entity Retrieve(string logicalName, string keyName, object keyValue, params string[] columns);

Retrieve<T> by Alternative key

Generic version of by Alternative key. This one use Execute under the hood

public T Retrieve<T>(string logicalName, string keyName, string keyValue, ColumnSet columnSet) where T : Entity;
public T Retrieve<T>(string logicalName, string keyName, string keyValue, params String[] columns) where T : Entity
Clone this wiki locally