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…
2 thoughts on “No lock and distinct conditions in query expression”
I do believe all of the ideas you have offered to your post. They are very convincing and can certainly work. Still, the posts are very quick for newbies. May you please prolong them a bit from subsequent time? Thank you for the post.
Sure Dong, will try to do so from my coming articles…earlier ones were just some tricks and tips…