Exemple #1
0
 /// <summary>
 /// Gets the first entity that matches the query.  Null is returned if none are found.
 /// </summary>
 /// <typeparam name="T">The Entity Type.</typeparam>
 /// <param name="service">The service.</param>
 /// <param name="qb">The query.</param>
 /// <returns></returns>
 public static T GetFirstOrDefault <T>(this IOrganizationService service, QueryBase qb) where T : Entity
 {
     qb.First();
     return(service.GetEntities <T>(qb).FirstOrDefault());
 }
Exemple #2
0
 /// <summary>
 /// Gets the first entity that matches the query expression.  Null is returned if none are found.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="query">The query.</param>
 /// <returns></returns>
 public static Entity GetFirstOrDefault(this IOrganizationService service, QueryBase query)
 {
     query.First();
     return(service.RetrieveMultiple(query).Entities.FirstOrDefault());
 }