【发布时间】:2013-11-28 12:36:07
【问题描述】:
在我遇到的一个小问题上得到任何帮助。
我有一个实体框架类
public partial class BookingProduct
{
public BookingProduct()
{
this.BookingDesigns = new ObservableCollection<BookingDesign>();
this.BookingDesigns.CollectionChanged += ContentCollectionChanged;
}
public int BookingProductId { get; set; }
public int ProductId { get; set; }
public decimal Price { get; set; }
public virtual ObservableCollection<BookingDesign> BookingDesigns { get; set; }
public virtual Product Product { get; set; }
public void ContentCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
//Retrieve Product here
}
}
在我的应用程序中,我从数据库中检索带有 BookingDesigns 的 BookingProduct,但不包括 Product。我想知道在实体类中是否有办法通过 ContentCollectionChanged 事件检索产品?
提前感谢您的任何指点
【问题讨论】:
标签: entity-framework observablecollection