Whenever i tried using query expression for retrieve multiple operations, came to know some interesting facts which exists and hence would like to share with you all.
As you already know Query expression was used when dealing with a little complex query, lets see this in action
Basic query expression example
// Query using ConditionExpression and FilterExpression ConditionExpression condition1 = new ConditionExpression(); condition1.AttributeName = "lastname"; condition1.Operator = ConditionOperator.Equal; condition1.Values.Add("Brown"); FilterExpression filter1 = new FilterExpression(); filter1.Conditions.Add(condition1); QueryExpression query = new QueryExpression("contact"); query.ColumnSet.AddColumns("firstname", "lastname"); query.Criteria.AddFilter(filter1); query.NoLock = true;//Condition to prevent occurrence of deadlocks, distinct was used to retrieve unique columnsets in the query EntityCollection result1 = _serviceProxy.RetrieveMultiple(query);
Hope this helps some one…