排除拥有实体类型的属性

时间:2019-08-14 19:12:29

标签: entity-framework-core

是否可以从exclude a propertyowned entity type

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

1 个答案:

答案 0 :(得分:0)

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