私は Entities Framework Code First を使用しており、次の 2 つのエンティティがあります。
public class Product
{
public int ProductID { get; set; }
public decimal Price { get; set; }
public int ProductCategoryID { get; set; }
public virtual ProductCategory ProductCategory { get; set; }
[NotMapped]
public int Quantity { get; set; }
}
public class ProductStorage
{
[Key]
public int ProductId { get; set; }
[ForeignKey("ProductId")]
public virtual Product Product { get; set; }
public int Quantity { get; set; }
}
プロパティProduct
で満たされたリストを取得できないようです。Quantity
私は試した
from pr in repository.Query<Product>()
join st in repository.Query<ProductStorage>() on pr.ProductID equals st.Quantity
select new Product()
{
ProductID = pr.ProductID,
....
Quantity = st.Quantity
};
しかし、それはうまくいきませんでした。