/// <summary> /// Gets all Entities where the columnNameAndValue Pairs match /// </summary> /// <typeparam name="T">Type of Entity List to return</typeparam> /// <param name="service"></param> /// <param name="anonymousTypeInitializer">An Anonymous Type Initializer where the properties of the anonymous /// type are the column names to add</param> /// <param name="columnNameAndValuePairs">List of pairs that look like this: /// (string name of the column, value of the column) ie. "name", "John Doe" </param> /// <returns></returns> public static IAsyncEnumerable <T> GetAllEntitiesAsync <T>(this IOrganizationServiceAsync2 service, Expression <Func <T, object> > anonymousTypeInitializer, params object[] columnNameAndValuePairs) where T : Entity { var columnSet = new ColumnSet(anonymousTypeInitializer.GetAttributeNamesArray()); return(service.GetAllEntitiesAsync <T>(columnSet, columnNameAndValuePairs)); }
/// <summary> /// Gets all Entities where the columnNameAndValue Pairs match /// </summary> /// <param name="service"></param> /// <param name="logicalName">LogicalName of the Entity.</param> /// <param name="columnSet">Columns to retrieve</param> /// <param name="columnNameAndValuePairs">List of pairs that look like this: /// (string name of the column, value of the column) ie. "name", "John Doe" </param> /// <returns></returns> public static IAsyncEnumerable <Entity> GetAllEntitiesAsync(this IOrganizationServiceAsync2 service, string logicalName, ColumnSet columnSet, params object[] columnNameAndValuePairs) { return(service.GetAllEntitiesAsync <Entity>(QueryExpressionFactory.Create(logicalName, columnSet, columnNameAndValuePairs))); }
/// <summary> /// Gets all Entities where the columnNameAndValue Pairs match /// </summary> /// <typeparam name="T">Type of Entity List to return</typeparam> /// <param name="service"></param> /// <param name="columnSet">Columns to retrieve</param> /// <param name="columnNameAndValuePairs">List of pairs that look like this: /// (string name of the column, value of the column) ie. "name", "John Doe" </param> /// <returns></returns> public static IAsyncEnumerable <T> GetAllEntitiesAsync <T>(this IOrganizationServiceAsync2 service, ColumnSet columnSet, params object[] columnNameAndValuePairs) where T : Entity { return(service.GetAllEntitiesAsync(QueryExpressionFactory.Create <T>(columnSet, columnNameAndValuePairs))); }