I think the easiest way to do it is simply add two properties manually in a non-autogenerated partial
class:
partial class Offer
{
public IQueryable<Product> Products
{
get { return this.ProductOffers.Select(x => x.Product); }
}
}
partial class Product
{
public IQueryable<Offer> Offers
{
get { return this.ProductOffers.OrderBy(x => x.Sort).Select(x => x.Offer); }
}
}
This won't help for when you want to add a new ProductOffer
, but since you actually have extra data (Sort
) you should be doing that via the ProductOffers
collection anyway.