实体框架核心6多到许多关系导航属性排除
我有两个链接的实体,这些实体具有多一到多的关系,如下所示:
public class Product
{
//Omitted code...
public virtual ICollection<Ingredient> ingredients { get; set; }
}
public class Ingredient
{
// Omitted code...
public virtual ICollection<Product> products { get; set; }
}
我的问题是:我只想加载product。关系的侧面是
impodient.products
。我想保持多一的关系。如何防止Intredient.products
导航属性被加载?
提前致谢
I have two entities linked that have a many-to-many relationship as shown here:
public class Product
{
//Omitted code...
public virtual ICollection<Ingredient> ingredients { get; set; }
}
public class Ingredient
{
// Omitted code...
public virtual ICollection<Product> products { get; set; }
}
My question is: I want to load only Product.ingredients
navigation property, and I don't want to load the other side of the relation which is ingredient.Products
. I want to keep the many-to-many relationship. How can I prevent the ingredient.Products
navigation property from being loaded ?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论