Monday, 23 June 2014

Using Query Expression

QueryExpression query1 = new QueryExpression()
                    {
                        EntityName = "prefix_entityname",
                        ColumnSet = new ColumnSet(true),
                        LinkEntities = {
                            new LinkEntity
                            {
                                JoinOperator = JoinOperator.Natural,
                                LinkFromEntityName = "prefix_entityname",
                                LinkFromAttributeName = "prefix_entitynameid",
                                LinkToEntityName = "prefix_entityname2",
                                LinkToAttributeName = "prefix_entitynameid",
                                LinkCriteria = new FilterExpression
                                {
                                    FilterOperator = LogicalOperator.And,
                                    Conditions  =
                                    {
                                        new ConditionExpression
                                        {
                                            AttributeName = "prefix_entityname2id",
                                            Operator = ConditionOperator.Equal,
                                            Values =  {
                                                entity2id
                                            }
                                        },
                                        new ConditionExpression
                                        {
                                         AttributeName = "prefix_entity2attribute2",
                                         Operator = ConditionOperator.Equal,
                                         Values = {
                                         attribute2value
                                         }
                                        }
                                    }
                                }
                            }
                        }
                    };

No comments:

Post a Comment