我最近开始评估 Dapper 作为 EF 的潜在替代品,因为我对正在生成的 SQL 不太满意,并希望对其进行更多控制。我有一个关于在我的域模型中映射复杂对象的问题。假设我有一个名为 Provider 的对象,Provider 可以包含多个 IEnumerable 类型的属性,这些属性只能通过父提供者对象(即聚合根)访问。我看过类似的帖子,这些帖子使用 QueryMultiple 和 Map 扩展方法进行了解释,但我想知道我是否想编写一个方法来恢复整个对象图的急切加载,如果 Dapper 能够一举做到这一点或者如果需要零碎完成。例如,假设我的对象如下所示:
public AggregateRoot
{
public int Id {get;set;}
...//simple properties
public IEnumerable<Foo> Foos
public IEnumerable<Bar> Bars
public IEnumerable<FooBar> FooBars
public SomeOtherEntity Entity
...
}
有没有使用 Dapper 填充整个对象图的简单方法?