0

我想将包含另一个对象的聚合实例的对象映射到单个表。

我有两个 POCO,例如:

[Table(Name = "TheTable")]

class A 
{
  [Column(Name = "PropA"), NotNull] 
  public string PropA { get; set; }

  public B TheOtherObject { get; set; }
}

class B
{
  public string PropB { get; set; }
}

我想对此进行映射,而不只是为了映射的目的而在 A 类中重复 B 类的所有属性。

| ID | PropA | PropB |

有没有办法用 linq2db 实现这一点?

我正在使用 MySQL 数据库。

4

1 回答 1

0

我刚刚找到了解决方案...

用注释类 A

[Column("PropB", "TheOtherObject.PropB")]

给出所需的行为。

于 2019-12-24T08:31:41.943 回答