Exemplo n.º 1
0
        /// <inheritdoc />
        public override bool HandleIncludes <T>(ref IQueryable <T> queryable, ITypeCache type, IEnumerable <QueryColumn> columns)
            where T : class
        {
            var changed = false;

            if (!type.HasProjectedTypeAttribute && queryable is DbSet <T> )
            {
                foreach (var refAttr in columns.Where(c => c.IsHidden != true).Select(c => c.Attribute).OfType <PersistentObjectAttributeWithReference>())
                {
                    var property = type.GetProperty(refAttr.Name);
                    if (property != null && property.IsMapped)
                    {
                        queryable = queryable.Include(refAttr.Name);
                        changed   = true;
                    }
                }
            }

            return(changed);
        }