Пример #1
0
        /// <summary>
        /// Gets first 5000 Active Entities where the values are in the columnName
        /// </summary>
        /// <param name="service"></param>
        /// <param name="logicalName">The LogicalName of the Entity to query.</param>
        /// <param name="columnName">The name of the column to perform the in against.</param>
        /// <param name="values">The list of values to search for being in the column name.</param>
        /// <returns></returns>
        public static List <Entity> GetEntitiesIn(this IOrganizationService service, string logicalName,
                                                  string columnName, params object[] values)
        {
            var settings = new LateBoundQuerySettings(logicalName);

            return(service.RetrieveMultiple(settings.CreateInExpression(columnName, values)).Entities.ToList());
        }
Пример #2
0
        /// <summary>
        /// Gets first 5000 Active Entities (with the given subset of columns only)
        /// where the values are in the columnName
        /// </summary>
        /// <param name="service"></param>
        /// <param name="logicalName">The LogicalName of the Entity to query.</param>
        /// <param name="columnSet">Columns to Return.</param>
        /// <param name="columnName">The name of the column to perform the in against.</param>
        /// <param name="values">The list of values to search for being in the column name.</param>
        /// <returns></returns>
        public static List <Entity> GetEntitiesIn(this IOrganizationService service, string logicalName,
                                                  ColumnSet columnSet, string columnName, IEnumerable values)
        {
            var settings = new LateBoundQuerySettings(logicalName)
            {
                Columns = columnSet,
            };

            return(service.RetrieveMultiple(settings.CreateInExpression(columnName, values)).Entities.ToList());
        }