public class Property : Item
{
public virtual ICollection<PropertyImage>
PropertyImages
{get; set;}
}
public class PropertyImage
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID
{get; set;}
public string FileName
{get; set;}
public bool IsFeatured
{get; set;}
public string
FileGuid
{get; set;}
[ForeignKey("Property")]
public int PropertyID
{get; set;}
public virtual Property
Property
{get; set;}
}
我必须在通过此方法请求财产清单时加载我的所有“propertyImages”
public IEnumerable<TEntity> GetMany(Expression<Func<TEntity, bool>> where, int count, params string[] includes)
{
var model = this.DbSet.AsExpandable().Where(where);
foreach (var property in includes)
{
model.Include(property);
}
if (count > 0)
return model.Take(count);
else
return model;
}
问题是不起作用,为每个属性加载了propertyImages列表(我有超过200个重复请求)