0
我想要如果列表的子類包含匹配。我是NHibernate的新手,正在尋求幫助。QueryOver標準與包含
謝謝
public class Shop
{
public virtual int ShopId { get; set; }
public virtual string ShopName { get; set; }
public virtual IList<DeliveryDistrict> DeliveryDistricts { get; set; }
}
public class DeliveryDistrict
{
public virtual int DeliveryDistrictId { get; set; }
public virtual Location.District District { get; set; }
}
public class District
{
public virtual int DistrictId { get; set; }
public virtual string DistrictName { get; set; }
}
stores = session.QueryOver<Entities.Shop.Shop>()
.Where(f => f.DeliveryDistricts.Contains(District)).ToList();
stores = session.QueryOver<Entities.Shop.Shop>()
.Where(p => p.DeliveryDistricts.Any(c => c.District.DistrictId == District.DistrictId)).List();