gpt4 book ai didi

entity-framework-core - 排除拥有实体类型中的属性(property)

转载 作者:行者123 更新时间:2023-12-05 03:59:05 26 4
gpt4 key购买 nike

有没有办法exclude a property来自 owned entity type

modelBuilder.Entity<Order>().OwnsOne(
o => o.ShippingAddress,
sa =>
{
sa.Property(p => p.Street).Ignore(); //doesn't compile
});

最佳答案

modelBuilder.Entity<Order>().OwnsOne(
o => o.ShippingAddress,
sa =>
{
//sa.Property(p => p.Street).Ignore(); //doesn't compile
sa.Ignore(p => p.Street); //this works 😊
});

Full sample来自 EntityFramework.Docs

关于entity-framework-core - 排除拥有实体类型中的属性(property),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57500705/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com