LinkEntity Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the links between multiple tables used in creating complex queries.
public ref class LinkEntity sealed : System::Runtime::Serialization::IExtensibleDataObject
[System.Runtime.Serialization.DataContract(Name="LinkEntity", Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")]
public sealed class LinkEntity : System.Runtime.Serialization.IExtensibleDataObject
[<System.Runtime.Serialization.DataContract(Name="LinkEntity", Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")>]
type LinkEntity = class
interface IExtensibleDataObject
Public NotInheritable Class LinkEntity
Implements IExtensibleDataObject
- Inheritance
-
LinkEntity
- Attributes
- Implements
Examples
/// <summary>
/// Return account and related primary contact data based on an account number
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance</param>
/// <param name="accountNumber">The account number to match.</param>
/// <returns>EntityCollection with any matching records</returns>
static EntityCollection LinkEntityExample(
IOrganizationService service,
string accountNumber)
{
QueryExpression query = new("account")
{
ColumnSet = new ColumnSet("name"),
Criteria = new FilterExpression(LogicalOperator.And)
{
Conditions = {
new ConditionExpression(
attributeName:"accountnumber",
conditionOperator: ConditionOperator.Equal,
value: accountNumber)
}
},
Orders = {
new OrderExpression(
attributeName:"name",
orderType: OrderType.Descending)
},
Distinct = true
};
LinkEntity primaryContactLink = query.AddLink(
linkToEntityName: "contact",
linkFromAttributeName: "primarycontactid",
linkToAttributeName: "contactid",
joinOperator: JoinOperator.Inner);
primaryContactLink.Columns.AddColumns("firstname", "lastname");
primaryContactLink.EntityAlias = "c";
return service.RetrieveMultiple(query: query);
}
Constructors
LinkEntity() |
Initializes a new instance of the LinkEntity class. |
LinkEntity(String, String, String, String, JoinOperator) |
Initializes a new instance of the LinkEntity class setting the LinkToEntityName, LinkFromAttributeName, LinkToAttributeName, and JoinOperator properties. |
Properties
Columns |
Gets or sets the set of columns to be returned. |
EntityAlias |
Gets or sets the alias for the related table. |
ExtensionData |
Gets or sets the structure that contains extra data. |
ForceSeek |
For internal use only. |
JoinOperator |
Gets or sets the join operator. |
LinkCriteria |
Gets or sets the complex condition and logical filter expressions that filter the results of the query. |
LinkEntities |
Gets the links between multiple tables. |
LinkFromAttributeName |
Gets or sets the logical name of the column of the table that you are linking from. |
LinkFromEntityName |
Gets or sets the logical name of the table that you are linking from. |
LinkToAttributeName |
Gets or sets the logical name of the column of the table that you are linking to. |
LinkToEntityName |
Gets or sets the logical name of the table that you are linking to. |
Orders |
Gets the order in which the records are returned from the query. |
Methods
AddLink(String, String, String) |
Adds a link to the LinkEntity.LinkEntities collection, setting the LinkToEntityName, LinkFromAttributeName, and LinkToAttributeName properties. |
AddLink(String, String, String, JoinOperator) |
Adds a link to the LinkEntity.LinkEntities collection, setting the LinkToEntityName, LinkFromAttributeName, LinkToAttributeName, and JoinOperator properties. |