示例#1
0
        public Fetch CreateFetch()
        {
            var columnSet = ColumnSets.SelectMany(set => set.ColumnSet).ToArray();
            var fetch     = new Fetch
            {
                Entity = new FetchEntity(LogicalName)
                {
                    Attributes = columnSet.Select(column => new FetchAttribute(column)).ToList()
                },
                SkipCache = true
            };

            if (ActiveStateCode != null)
            {
                fetch.AddFilter(new Filter
                {
                    Conditions = new List <Condition>
                    {
                        new Condition("statecode", ConditionOperator.Equal, ActiveStateCode.Value)
                    }
                });
            }

            return(fetch);
        }
示例#2
0
        private ICollection <FetchAttribute> GetFetchAttributes()
        {
            // merge the column sets

            return(ColumnSets.SelectMany(set => set.ColumnSet).Select(set => new FetchAttribute {
                Name = set
            }).ToArray());
        }